如何在drupal中传递带有图片网址的cookie?

时间:2014-01-03 08:58:15

标签: drupal-7 drupal-services drupal-input-format

这里我将图片网址传递给服务器以获取图片。但我的路径是私有的,那么如何通过图像URL传递cookie以从服务器获取图像?

1 个答案:

答案 0 :(得分: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.