RE: [PHP] Useragent and file [SOLN]
| From: | Todd Pasley | Date: | Fri, 30 Aug 2002 18:42:18 +0000 |
| Subject: | RE: [PHP] Useragent and file [SOLN] | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-114684@lists.php.net to get a copy of this message | ||
Hi
I found an alternative to using file to get web content.
using fsockopen you can specify a useragent as per rfc-something which
handles it all very very nicely.
Its also nicer that what I was using to post and is looking more likely to
store cookies/sessions... but ill get to that later :)
thanks to anyone who thought about replying :)
Maybe this discovering might help someone else also, hence my post.
Later,
Todd.
> -----Original Message-----
> From: Todd Pasley [mailto:toddp@kjross.com.au]
> Sent: Friday, 30 August 2002 6:19 PM
> To: php-general@lists.php.net
> Subject: [PHP] Useragent and file
>
>
> Hi
>
> Im using file() to get the contents of a webpage. e.g
>
> // get a web page into an array
> $fcontents= file ($targeturl);
>
> However I dont know how to mimic a different useragent. Using
> LWP::UA (in perl) i can pretend to be iexplore6 running on win2k
> or anything i want.. Is there a way i can do this in PHP?
>
> By changing the useragent will this also resolve problems with
> javascript?, I'd like the target server to think that I can view/run it.
>
> Thanks heaps,
>
> Todd.
>