1

here i am passing the image url to the server to get the images. But my path is private so how can i pass the cookie with the image URL to get the image from the server ?

rupesh
  • 2,865
  • 4
  • 24
  • 50

1 Answers1

1
You can create cookies with  using this command .
setcookie("user", "$value", time()+3600)

then get all the cookies in the variable like this
$cookiestring = '';
foreach ($_COOKIE as $key => $cookie) {
$cookiestring .= $key .'='. urlencode($cookie)
} 

then create the $Header
$headers = array('Cookie' => $cookiestring);

then you can pass it like this
drupal_http_request($url, array('headers' => $headers));

I hope it works for you or you will get the little idea how to do it.
Ranjeet SIngh
  • 673
  • 1
  • 9
  • 23