Jump to content

How to spoof your useragent as googlebot with php- curl or file_get_contents


Recommended Posts

Don't pretend to be google, be your browser, people know you are not google by the ip.

 

Here is a few different methods, if need a different user-agent string, look them up

 

for curl:

curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT x.y; Win64; x64; rv:10.0.1) Gecko/20100101 Firefox/10.0.1');

 

in htaccess:

php_value user_agent Mozilla/5.0 (Windows NT x.y; Win64; x64; rv:10.0.1) Gecko/20100101 Firefox/10.0.1

 

within a php script:

ini_set('user_agent', 'Mozilla/5.0 (Windows NT x.y; Win64; x64; rv:10.0.1) Gecko/20100101 Firefox/10.0.1');

 

for file_get_contents you use the ini_set() above

 

Don't pretend to be google, be your browser, people know you are not google by the ip.

 

Here is a few different methods, if need a different user-agent string, look them up

 

for curl:

curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT x.y; Win64; x64; rv:10.0.1) Gecko/20100101 Firefox/10.0.1');

 

in htaccess:

php_value user_agent Mozilla/5.0 (Windows NT x.y; Win64; x64; rv:10.0.1) Gecko/20100101 Firefox/10.0.1

 

within a php script:

ini_set('user_agent', 'Mozilla/5.0 (Windows NT x.y; Win64; x64; rv:10.0.1) Gecko/20100101 Firefox/10.0.1');

 

for file_get_contents you use the ini_set() above

 

Hi thank you for that, exactly what I was looking for!

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.