so I’m using drupal_http_request()Docs to fetch another page…the thing is that page is within a logged in area so the function returns the login page instead of the proper page that contains the current session….is there a way to configure drupal_http_request() so that it uses the current session to fetch the page or to pass the session data in?
so I’m using drupal_http_request() Docs to fetch another page…the thing is that page is
Share
When you want to inject the session into the HTTP request, you must mimic the standard behavior. Depending on how your session works, this means either adding the session cookie or the session get parameter.
drupal_http_request()Docs allows you to specify headers. You can for example build the cookie header for your session and then send it with the request.To see how the cookie header is build, analyse the request-headers your browser sends to your drupal site, you can do that with firebug. Look for the
Cookie:header in the request headers. Note that it can differ depending on server configuration.You then can add the cookie information to the
$headersparameter: