Jump to content

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


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:

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.