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 ?
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.