tags:

views:

32

answers:

3

Is it possible to 'translate' headers from this firefox extension into server side script?

edit:

I'm trying to SEND headers, not retrieve them. I performed some actions in browser and i want them to be automatically repeated (with few changes) by server-side script.

+2  A: 

You can use PHP's header() function to send headers to the user's browser.

If you're making HTTP requests to other sites from your server, use cURL's curl_setopt function to set the CURLOPT_HTTPHEADER option - you can provide an array of headers to pass along with your request.

ceejayoz
i'm thinking about posting for example
Phil
...so i want to send headers from my site to other sites and/or to other pages on my site
Phil
OK, I've updated with information on doing it from your site to another page.
ceejayoz
stuff like with curl - posting to forms, etc but without coding whole curl session... just taking headers (for example when i posted to form on my site via browser) from firefox extension and repeating them
Phil
thanks, i'll have to check out curlopt_httpheader! upvoted
Phil
A: 

Consider print_r(apache_request_headers());

PHP Manual: apache_request_headers()

Here is an example and its source code.

Ted Percival
that's pretty cool, but i DO have headers... i want to post them, not retrieve them
Phil
A: 

Use the cURL functions for your request and use curl_setopt:

curl_setopt(CURLOPT_HTTPHEADER,  array('Referer: http://www.example.com/'));
Ted Percival