Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello,
I'm super happy that I got Apache, PHP, MySQL, and phpMyAdmin working wonderfully on Suse 10. I'm facing a challenge however that I could use some advise on.
I'm loading an xml file into my php script. It works great when going through my hosting company (based on linux). Here is what a portion of it looks like:
PHP Code:
$units="f";
$location="80218";
$weatherfile = "http://xml.weather.yahoo.com/forecastrss?p=$location&u=$units"; if (!($fp = @fopen($file, "r"))) { //Remove the "@" to see error messages. $theResponse = "I can't seem to connect to the weather source right now. Is the internet on?";
} else { $theResponse = "The file loaded just great."; } echo($theResponse);
When I run this script on my machine, I get this error:
Warning: fopen(http://xml.weather.yahoo.com/forecastrss?p=80401&u=f): failed to open stream: HTTP request failed! in /home/ultrus/public_html/aiml/programE/src/plugins/cs_weather.php on line 72
RESPONSE: I can't seem to connect to the weather source right now. Is the internet on?
Is there some type of Apache or PHP security setting or firewall setting that is preventing me from loading file sources from the internet? How do I fix it? Thanks for the help.
Ah yes. Sorry about that. I tried to abbriviate the code as $file was once part of a function that it is now not a part of. Here is the code with your correction:
PHP Code:
$units="f";
$location="80218";
$weatherfile = "http://xml.weather.yahoo.com/forecastrss?p=$location&u=$units"; if (!($fp = @fopen($weatherfile, "r"))) { //Remove the "@" to see error messages. $theResponse = "I can't seem to connect to the weather source right now. Is the internet on?";
} else { $theResponse = "The file loaded just great."; } echo($theResponse);
Interesting. I just tried it myself and it worked just fine. I just took your code and tested it myself with the following fragment:
Quote:
<?PHP
$units="f";
$location="80218";
$weatherfile = "http://xml.weather.yahoo.com/forecastrss?p=$location&u=$units";
if (!($fp = @fopen($weatherfile, "r"))) { //Remove the "@" to see error messages.
$theResponse = "I can't seem to connect to the weather source right now. Is the internet on?";
} else {
$theResponse = "The file loaded just great.";
}
echo($theResponse);
?>
Yeah, I tried it on my PC Apache/PHP testing server with success. It works on my hosted website as well. When I test it on my Linux testing server laptop through, it sits for a long time, then gives me that error message.
I tried disabling my firewall. It still seems to be having the same problem. One guess is my wireless connection might be blocked somehow by the office firewall or something odd like that. This might be a far throw, but I'll know for sure when I connect this thing to the Internet at home. I'll post an update if I find anything.
Oh! That's a good tip. My Linux is using PHP4, while everything else is using PHP5. That could make a difference. It seems that Suse 10 doesn't include PHP5 on the 5 disc set. I'll start looking for a stupid-proof set of instructions for installing it on this laptop. Thanks!
I don't think your problem is a difference between php4 and php5. This looks to be more like a permissions issue with php. You might want to take a look at your php.ini file on the laptop and see if there is anything in there that might be preventing it. For that matter, you may want to take a look at the apache server settings as well.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.