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!
My current project involves grabbing news headlines from a local news website and slotting them into the client's website. There's no copyright issues involved - all that has been cleared up (thank goodness )
Warning: file(http%3A%2F%2Fwww.news.com.au%2Fcommon%2Fstorylib%2F0%2C4810%2CBreakingNews%25255EBREAKING%252520NEWS%25255ETEXT%25255Enews%2C00.html): failed to open stream: No such file or directory in D:\Program Files\Apache Group\Apache2\htdocs\MyHSCAdmin\TMPsb0s1idfog.php on line 94
Warning: implode(): Bad arguments. in D:\Program Files\Apache Group\Apache2\htdocs\MyHSCAdmin\TMPsb0s1idfog.php on line 94
When I replace the nasty looking $GrabURL with a local copy of the same file everything works no worries. The fopen_wrappers are turned on. I get the same errors running on two different servers!
Any help is v.v.appreciated!
Even without the urlencode() I still get the same errors on both servers.
I thought it might have been a problem with all the comments and arguments in the URL, however I get the same errors trying to load a plain .html page from another server.
I know both files exist because I can view them in the browser. Is there some setting in PHP.ini or in httpd.conf that needs to be changed to make this work?
Even trying to do a simple include("http://...") fails with similar errors.
If your getting errors that way, then why not try a different way of doing it. PHP has several ways to do every task - so just take a different route. Maybe something like:
Thanks, but I tried that too. It seems that any kind of function that involves resolving a remote address ie. "http://..." causes it to come up with this error.
Like I said, I thought it might have been the complex URL I was trying to grab, but it doesn't work using simple http://server.com/page1.html either.
As the page I intend to copy from is updated hourly, manually copying the file to the local system to reference isn't an option.
Warning: fsockopen(): php_network_getaddresses: gethostbyname failed in D:\Program Files\Apache Group\Apache2\htdocs\MyHSCAdmin\Snoopy.class.inc on line 1061
Warning: fsockopen(): unable to connect to www.slashdot.org:80 in D:\Program Files\Apache Group\Apache2\htdocs\MyHSCAdmin\Snoopy.class.inc on line 1061
error fetching document: connection failed (0)