Function errors please help!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
harbinc
Forum Newbie
Posts: 3
Joined: Wed Feb 18, 2004 2:40 pm

Function errors please help!

Post 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.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post 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.
harbinc
Forum Newbie
Posts: 3
Joined: Wed Feb 18, 2004 2:40 pm

Here is the code sniplet

Post 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);
}
Post Reply