Title: hey Post by: SFS on August 29, 2006, 09:09:07 PM I'm reposing this for a guy on another foums.
Well I am having some problems. I moved to a new server and they are running PHP5. I don't a single damn thing about PHP5 and I barely was able to stay afloat with PHP4. So I was wondering if anyone could help me with this: Quote: $scfp = fsockopen("38.96.148.32", 9980, &$errno, &$errstr, 30); if(!$scfp) { $scsuccs=1; echo''.$scdef.' is Offline'; } if($scsuccs!=1){ fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n"); while(!feof($scfp)) { $p So after the script runs this is what I get Quote: Warning: fsockopen() [function.fsockopen]: unable to connect to 38.96.148.32:9980 (Connection timed out) in stats.php on line 25 Any ideas? Anyone? Please? Any help would, er.. help. Title: Re: hey Post by: The Metamorphosing Leon on August 29, 2006, 10:47:57 PM Wow.
Title: Re: hey Post by: TraderJake on August 29, 2006, 10:52:25 PM No Clue, this site runs on PHP 4, and it looks as though he is using a socket connection, which is something we do not use. The warning is saying that the function is timing out, which sounds like a connection error. I am sure you've seen Warnings on this site periodically when the site can't connect to the mySQL server. If it was a fatal error it wouldn't have done much of anything other than spit out a parse error.
Of course, PHP.net is down right now. Which makes this harder to research. I'll get back to you. Title: Re: hey Post by: Hydrobond on August 30, 2006, 05:58:44 AM My first thought is to make sure the server he is trying to connect to at 38.96.148.32 has port 9980 open.
Also, a simple google search shows the syntax as $fp = fsockopen("www.example.com", 80, $errno, $errstr, 30); notice there are no '&' in the arguments $errno and $errstr. I don't know if that makes a difference, as I know absolutely nothing about Perl, but it would in C so I thought I would mention it. Title: Re: hey Post by: The Metamorphosing Leon on August 30, 2006, 01:24:43 PM Just wow.
Title: Re: hey Post by: Hydrobond on August 30, 2006, 03:57:44 PM Can you tell us what he is trying to do?
I'm kinda curious as to why he would be trying to establish a connection (socket) on that port if he is running a web server. Title: Re: hey Post by: bum-man on August 30, 2006, 07:46:17 PM My first thought is to make sure the server he is trying to connect to at 38.96.148.32 has port 9980 open. I think that PHP5 does not require the & to signify that the variable is being passed by reference (rather than by value), so the code should work the same either way.Also, a simple google search shows the syntax as $fp = fsockopen("www.example.com", 80, $errno, $errstr, 30); notice there are no '&' in the arguments $errno and $errstr. I don't know if that makes a difference, as I know absolutely nothing about Perl, but it would in C so I thought I would mention it. Title: Re: hey Post by: bum-man on August 31, 2006, 12:18:35 AM That PHP seemed to work OK for me on a host with PHP 5.1.2, well it tried to connect but got an unauthorized error because I just made up a password. Based on his error and mine my guess is this is not an issue of PHP4 vs PHP5. There is a possibility that the new host the guy is using doesn't support outbound socket connections.
FYI, For those wondering this script is used to connect to a internet radio station site (ShoutCast server) and get the recent play list. |