[PHP] Problems reading a URL

2002-04-01 Thread Stephen Phillips

Hi,
I'm working on a script to read in the results from a search engine and find out a 
website's position in the results.  I've run into some problems trying to read the 
results in from google, it seems no matter how I try to open the page in php it still 
won't read the results.  I've tried using different functions to read the page, but 
all with no luck, it seems that php thinks the page doesn't exist.  If anyone has any 
experience of a similar problem reading a file, or has any idea's on how to get it to 
read (maybe I missed something obvious), please let me know,

Here's some examples of what I've tried so far,

example 1

$fp = fopen(http://www.google.com/search?q=$keywordsnum=10hl=enstart=1sa=N,r;);
if ($fp)
{ printThe file exists!;

$contents = fread ($fp,10);

echo $contents;

 }
else
{ printThe file does not exist; }

example 2

$contents = join ('', file 
('http://www.google.com/search?q=$keywordsnum=10hl=enstart=1sa=N'));
if(isset($contents)){
echo $contents;
}
else{
echo The file does not exist;
}

I've avoided using functions like readfile, and fpassthru since they dump the file to 
output imediately, and I want to get the page as a string I can search.  Hope somone 
has some idea's on this,

Thanks,

Steve.




Re: [PHP] Problems reading a URL

2002-04-01 Thread Jason Wong

On Monday 01 April 2002 21:22, Stephen Phillips wrote:
 Hi,
 I'm working on a script to read in the results from a search engine and
 find out a website's position in the results.  I've run into some problems
 trying to read the results in from google, it seems no matter how I try to
 open the page in php it still won't read the results.  I've tried using
 different functions to read the page, but all with no luck, it seems that
 php thinks the page doesn't exist.  If anyone has any experience of a
 similar problem reading a file, or has any idea's on how to get it to read
 (maybe I missed something obvious), please let me know,

 Here's some examples of what I've tried so far,

 example 1

 $fp =
 fopen(http://www.google.com/search?q=$keywordsnum=10hl=enstart=1sa=N;
,r); if ($fp)
 { printThe file exists!;

Google is probably trying to give you a cookie. You can verify this by trying 
various sites that are known to send cookies and then again with sites that 
don't.

You may need to use something more sophisticated like curl, or write your own 
function(s) based on fsockopen().


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Men take only their needs into consideration -- never their abilities.
-- Napoleon Bonaparte
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Problems reading a URL

2002-04-01 Thread Rick Emery

You want Snoopy:  http://snoopy.sourceforge.com


-Original Message-
From: Stephen Phillips [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 7:22 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Problems reading a URL


Hi,
I'm working on a script to read in the results from a search engine and
find out a website's position in the results.  I've run into some problems
trying to read the results in from google, it seems no matter how I try to
open the page in php it still won't read the results.  I've tried using
different functions to read the page, but all with no luck, it seems that
php thinks the page doesn't exist.  If anyone has any experience of a
similar problem reading a file, or has any idea's on how to get it to read
(maybe I missed something obvious), please let me know,

Here's some examples of what I've tried so far,

example 1

$fp =
@fopen(http://www.google.com/search?q=$keywordsnum=10hl=enstart=1sa=N;,
r);
if ($fp)
{ printThe file exists!;

$contents = fread ($fp,10);

echo $contents;

 }
else
{ printThe file does not exist; }

example 2

$contents = @join ('', file
('http://www.google.com/search?q=$keywordsnum=10hl=enstart=1sa=N'));
if(isset($contents)){
echo $contents;
}
else{
echo The file does not exist;
}

I've avoided using functions like readfile, and fpassthru since they dump
the file to output imediately, and I want to get the page as a string I can
search.  Hope somone has some idea's on this,

Thanks,

Steve.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Problems reading a URL

2002-04-01 Thread Rick Emery

It's been moved:  http://sourceforge.net/projects/snoopy/

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 8:08 AM
To: 'Stephen Phillips'; [EMAIL PROTECTED]
Subject: RE: [PHP] Problems reading a URL


You want Snoopy:  http://snoopy.sourceforge.com


-Original Message-
From: Stephen Phillips [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 7:22 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Problems reading a URL


Hi,
I'm working on a script to read in the results from a search engine and
find out a website's position in the results.  I've run into some problems
trying to read the results in from google, it seems no matter how I try to
open the page in php it still won't read the results.  I've tried using
different functions to read the page, but all with no luck, it seems that
php thinks the page doesn't exist.  If anyone has any experience of a
similar problem reading a file, or has any idea's on how to get it to read
(maybe I missed something obvious), please let me know,

Here's some examples of what I've tried so far,

example 1

$fp =
@fopen(http://www.google.com/search?q=$keywordsnum=10hl=enstart=1sa=N;,
r);
if ($fp)
{ printThe file exists!;

$contents = fread ($fp,10);

echo $contents;

 }
else
{ printThe file does not exist; }

example 2

$contents = @join ('', file
('http://www.google.com/search?q=$keywordsnum=10hl=enstart=1sa=N'));
if(isset($contents)){
echo $contents;
}
else{
echo The file does not exist;
}

I've avoided using functions like readfile, and fpassthru since they dump
the file to output imediately, and I want to get the page as a string I can
search.  Hope somone has some idea's on this,

Thanks,

Steve.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Problems reading a URL

2002-04-01 Thread J. Scott Johnson

Just as an aside, sourceforge seems to have changed the url.  Its now:

http://sourceforge.net/projects/snoopy/

(I was interested too).

Scott

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 9:12 AM
To: 'Stephen Phillips'; [EMAIL PROTECTED]
Subject: RE: [PHP] Problems reading a URL


It's been moved:  http://sourceforge.net/projects/snoopy/

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 8:08 AM
To: 'Stephen Phillips'; [EMAIL PROTECTED]
Subject: RE: [PHP] Problems reading a URL


You want Snoopy:  http://snoopy.sourceforge.com


-Original Message-
From: Stephen Phillips [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 7:22 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Problems reading a URL


Hi,
I'm working on a script to read in the results from a search engine and
find out a website's position in the results.  I've run into some problems
trying to read the results in from google, it seems no matter how I try to
open the page in php it still won't read the results.  I've tried using
different functions to read the page, but all with no luck, it seems that
php thinks the page doesn't exist.  If anyone has any experience of a
similar problem reading a file, or has any idea's on how to get it to read
(maybe I missed something obvious), please let me know,

Here's some examples of what I've tried so far,

example 1

$fp =
@fopen(http://www.google.com/search?q=$keywordsnum=10hl=enstart=1sa=N;,
r);
if ($fp)
{ printThe file exists!;

$contents = fread ($fp,10);

echo $contents;

 }
else
{ printThe file does not exist; }

example 2

$contents = @join ('', file
('http://www.google.com/search?q=$keywordsnum=10hl=enstart=1sa=N'));
if(isset($contents)){
echo $contents;
}
else{
echo The file does not exist;
}

I've avoided using functions like readfile, and fpassthru since they dump
the file to output imediately, and I want to get the page as a string I can
search.  Hope somone has some idea's on this,

Thanks,

Steve.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Problems reading a URL

2002-04-01 Thread Stephen Phillips

Thanks everyone,
Snoopy looks just like what I need to use, if only I'd known about this sooner, I 
could have saved myself alot of time :)

Steve.