fapapfap Posted December 28, 2011 Share Posted December 28, 2011 I would like to spoof the useragent as googlebot through the implementation of file_get_contents, or curl (which ever is easiest). How to do this? Googlebot useragent = Googlebot/2.1 (+http://www.google.com/bot.html) Quote Link to comment https://forums.phpfreaks.com/topic/253930-how-to-spoof-your-useragent-as-googlebot-with-php-curl-or-file_get_contents/ Share on other sites More sharing options...
Pikachu2000 Posted December 28, 2011 Share Posted December 28, 2011 There is no legitimate reason to do that. Quote Link to comment https://forums.phpfreaks.com/topic/253930-how-to-spoof-your-useragent-as-googlebot-with-php-curl-or-file_get_contents/#findComment-1301766 Share on other sites More sharing options...
fapapfap Posted December 28, 2011 Author Share Posted December 28, 2011 There is no legitimate reason to do that. What are you talking about? Quote Link to comment https://forums.phpfreaks.com/topic/253930-how-to-spoof-your-useragent-as-googlebot-with-php-curl-or-file_get_contents/#findComment-1301802 Share on other sites More sharing options...
QuickOldCar Posted December 28, 2011 Share Posted December 28, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/253930-how-to-spoof-your-useragent-as-googlebot-with-php-curl-or-file_get_contents/#findComment-1301832 Share on other sites More sharing options...
fapapfap Posted December 28, 2011 Author Share Posted December 28, 2011 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! Quote Link to comment https://forums.phpfreaks.com/topic/253930-how-to-spoof-your-useragent-as-googlebot-with-php-curl-or-file_get_contents/#findComment-1301851 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.