Page 1 of 1

Function errors please help!

Posted: Wed Feb 18, 2004 2:40 pm
by harbinc
Hey guy I installed a script on my server to run and I am getting the following errors. Do i need to configure my php.ini to fix these errors? The script works fine on another server I use.

<b>Warning</b>: feof(): supplied argument is not a valid File-Handle resource in <b>/home/admin/3.php</b> on line <b>108</b><br />
<br />
<b>Warning</b>: fread(): supplied argument is not a valid File-Handle resource in <b>/home/admin/3.php</b> on line <b>109</b><br />
<br />
<b>Warning</b>: feof(): supplied argument is not a valid File-Handle resource in <b>/home/admin/3.php</b> on line <b>110</b><br />

Any help is appreciated.

Posted: Wed Feb 18, 2004 2:43 pm
by markl999
Something went wrong with your fopen() line. The file your trying to open probably doesn't exist or doesn't have the correct permissions.

Here is the code sniplet

Posted: Wed Feb 18, 2004 2:45 pm
by harbinc
#Get the first 1000 results
echo "Search term: " . urldecode($searchterm) . "\nGetting up to 1000 results. This can take several minutes.\n";
for($start = 0; $start <= 900; $start+=100){
if($start > 0)
$extra = "&start=$start";
$sock = fsockopen("www.google.com", 80);
fputs($sock, "GET /search?q=$searchterm&num=100&sa=N$extra$filter HTTP/1.1\r\nHost: http://www.google.com\r\nConnection: Close\r\n$cookie\r\n\r\n");
while(!feof($sock)){
$result .= fread($sock, 10240);
if(feof($sock))
break;
}
sleep(10);
}