Re: Getting page with fopen
| From: | Jason Wong | Date: | Thu, 25 Apr 2002 08:53:54 +0000 |
| Subject: | Re: Getting page with fopen | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-94523@lists.php.net to get a copy of this message | ||
On Thursday 25 April 2002 16:39, Martin Thoma wrote:
> Hello!
>
> I'm trying to find out on which rank my side is at google automatically.
> I'm trying the following code, but I get a strange error:
>
> $Url = "http://www.google.de/search?q=MySearchWord";
> // Gives "Warning:
> No error on line [where fopen is]"
> $Url = "http://www.google.de/"; // Works
>
> for ($i = 0; $i < 100; $i += 10)
> { $fp = fopen($Url, "r");
> while($fp && !feof($fp))
> { $sLine .= fgets($fp, 4096);
> }
> ... do some further things with $sLine
> fclose($fp);
> }
>
> How can I get more information about the error occuring? "Warning: No
> error" is not much information...
Google is probably trying to send you a cookie in which case you cannot use
fopen. You need to use curl or snoopy(?).
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
When the wind is great, bow before it;
when the wind is heavy, yield to it.
*/