Page 1 of 1

Change browser name on file_get_contents or cURL request

Posted: Fri Oct 03, 2008 9:35 am
by LuckyShot
Good day,

I am using file_get_contents() function to get external content from an external website (...and format it in XML, etc.).

I was wondering if there is any way in PHP to modify the browser information requesting the external page.
So that when executing a file_get_contents I could customize it to get the content as if it was seen through
whatever browser I decide (Firefox, Explorer, Safari...).
It's not about detecting the browser type but changing the browser type when requesting the page.

Is that feasible in PHP5 ...or 6?
I have read the PHP manual and can't find any information regarding this. Not even a relevant result by Googling it.
Maybe through cURL instead of file_get_contents?

Please let me know if you need any more details, examples or explanation.

Thank you and best regards,

LuckyShot

Re: Change browser name on file_get_contents or cURL request

Posted: Fri Oct 03, 2008 2:30 pm
by phppucci
use curl. there you can setup everything you need.