Forum Moderators: coopster

Message Too Old, No Replies

Customizing the "User Agent" with cURL Screen Scraping?

         

erikcw

10:32 pm on Aug 23, 2004 (gmt 0)

10+ Year Member



Hi,

I have a script which performs a screen scrape of a webpage using cURL. I was wondering, how can I customize the "User-Agent" that shows up in the server-logs whenever my tool is used so that I can track it's usage on my site.

Thanks!

Erik

lazydog

11:09 pm on Aug 23, 2004 (gmt 0)

10+ Year Member



Use -
curl_setopt($handle, CURLOPT_USERAGENT, "Mozilla 1.7")

You can find more in the php manual.

Saurabh.

jusdrum

4:29 pm on Aug 24, 2004 (gmt 0)

10+ Year Member



On a side note, you can use PHP's file_get_contents() function ( [php.net...] ) to grab the contents of encrypted/non-encrypted URLs as well.