Hi I'm trying to implement your search function to my website but I keep getting this error output when I run it: Warning : feof(): supplied argument is not a valid File-Handle resource in /w2/h/www.hannonfoundation.org/html/results.php on line 39 Warning : fclose(): supplied argument is not a valid File-Handle resource in /w2/h/www.hannonfoundation.org/html/results.php on line 42 Parse error : parse error in /w2/h/www.hannonfoundation.org/html/results.php(44) : eval()'d code on line 1 I do have a google key which I entered into results.php and I have site set to "". I also tried it with my site name and got the same results. Do you have any idea what may be wrong?
On the line that has: $handle = @fopen (... remove the @ from the command, and it will return to your browser any errors it may have encountered. - Shawn
This is what it says now: Warning: fopen("http://search.digitalpoint.com/?q=hannon&key=***************************&site=&start=0", "r") - No such file or directory in /w2/h/www.hannonfoundation.org/html/results.php on line 38 Warning: feof(): supplied argument is not a valid File-Handle resource in /w2/h/www.hannonfoundation.org/html/results.php on line 39 Warning: fclose(): supplied argument is not a valid File-Handle resource in /w2/h/www.hannonfoundation.org/html/results.php on line 42
Your version of PHP is not allowing URLs within fopen. It's on by default, so someone would have had to disable it. You will need to get your administrator to enable it for you within PHP. You can find info on it at: http://us3.php.net/manual/en/ref.filesystem.php#ini.allow-url-fopen - Shawn
OK, that fixed all the errors showing up, but now when I do a search nothing shows up at all. You can see my test search page here: http://209.151.246.229/test_search.html
Yeah, i did that and still nothing. When I look at the source for the page that is generated after the search I notice that it is only printing the header file info. There is no code beyond that. Another strange thing is that if I upload the original header and footer that came with the download I get an error message that says that the browser couldn't load any data from that location. Then when I upload the header and footer that I created for my site, it works again. I have attached text files with the header, footer, and results (with my google key removed) files. If you want to see the test search it's here http://209.151.246.229/test_search.html Also if you want to see the info for my php install it's here http://209.151.246.229/version.php
Hmmmm... I really have no idea, you may want to check the httpd error log to see if it logs any errors on your server. I setup those 3 files on this end (no changes other than the extension), and they worked fine (of course it said invalid authorization key). It seems like your end completely drops out after the header.php include. Try removing that line from results.php and see if it works without the include for some reason. - Shawn
Hmmm. Starnge. When I take out all the includes, I get that same error message that says that the browser couldn't load any data from that location. But when I leave the includes in and take everything else out, the entire template page loads (header and footer). So it seems that something in the code that goes between the header and footer includes is stopping the entire php script from running. Is there anything else that needs to be activated in the php setup that would prevent it from working? I don't know if you looked at my server setup, but I am running php 4.2.3 on a unix server (I believe it is apache 1.3.27).
Well the inability to load data from that location is the previous problem I mentioned (where you wold need to have URL support for fopen() in your version of PHP). There is nothing wrong with the files though, as I tried yours on this end, and they work. Strange it drops the script out on the fopen() error when there is an include though. - Shawn
Is there any way I could get the phpinfo() for the server that you ran the php search file on that worked? Or could you run php diff comparing your server and mine? Thech support for the hosting company i'm using can't seem to figure it out. That is what they reccomended asking for.
is there anything in the code on your side that would be version dependent of the version of php that i am running on my machine? or could there be some sort of server setting on my server that could be blocking me from sending data to http://search.digitalpoint.com? sorry to keep posting, but this frustrating because it works on the little web server i have on my machine at home no problem.
Nope... there is nothing on this end that makes it PHP version dependent. It just needs support for URLs within fopen() (which is on by default). - Shawn