Jump to content

[SOLVED] How to modify php's "header" when opening a URL (with fwrite "r"?)?


physaux

Recommended Posts

Hey guys, I was wondering if someone could point me somewhere on how I could modify php's "header information" or something like that, so that when I read another page with fopen($url, "r"), I don't want it to know that php is accessing it. Some sites block php's header, so I would like to change it to look like firefox's or something.

 

Any clues?

There are no special "PHP headers" sent (unless you define them yourself, not by default) informing remote sites that it is PHP grabbing the file rather than a normal person via a browser.  However (again by default) PHP will not send the same headers that a browser might.  The most usual difference is that no User-Agent header is sent from PHP scripts.  You can send one using, as Crayon Violent so succinctly pointed out, cURL, or you can continue using fopen and provide a stream context specifying the user agent header to send.

 

Useful links for the latter include:

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.