jatar_k

msg:3501263 | 3:38 am on Nov 10, 2007 (gmt 0) |
try using cURL, make it look like a user [php.net...] depending on what you are doing, watch the number of requests over time
|
Srirangan

msg:3501524 | 3:46 pm on Nov 10, 2007 (gmt 0) |
Try this:
<?php // An example, get a web page into a string. See also file_get_contents(). $html = implode('', file('http://www.example.com/')); ?>
Also, RTFM! :)
|
vincevincevince

msg:3501530 | 4:00 pm on Nov 10, 2007 (gmt 0) |
Hello Srirangan, Welcome to WebmasterWorld! [webmasterworld.com] Your method should work the same way as the fopen() method. The problem identified originally is correct, Google do not encourage automated querying of their search engine. Just changing the user agent used by PHP will be enough I believe but do be aware that repeated or frequent automated access to Google will mean your IP gets blocked. ini_set('user_agent','Custom Script for example.com'); As I recall, it is only the default PHP user agent which is blocked; you don't need to pretend to be a browser and nor should you do so. Do remember to pay attention to the robots.txt file for Google which bans your URL explicitly as it starts with /search: [google.com...] Google do offer an wide range of APIs: [code.google.com...] This is the recommended method for accessing the content and the one which Google allows.
|
SixTimesEight

msg:3501541 | 4:11 pm on Nov 10, 2007 (gmt 0) |
| As I recall, it is only the default PHP user agent which is blocked... |
| This does indeed appear to be the case. I changed the user agent and my script is now working as expected.
|
Srirangan

msg:3501551 | 4:19 pm on Nov 10, 2007 (gmt 0) |
Woops.. sorry missed that vince.. :o)
|
|