3raser Posted November 5, 2009 Share Posted November 5, 2009 Sorry for the title. Warning: fsockopen() [function.fsockopen]: unable to connect to udp://:0 (Failed to parse address "") in /home/a9726309/public_html/server.php on line 4 Code: <?php $server = $_POST['ip']; $port = $_POST['port']; $status = fsockopen( 'udp://' . $server, $port, $errno, $errstr, 3 ); if ( !$status ) { //include 'offline.gif'; die('<img src="offline.gif" />'); } else { //include 'online.gif'; die('<img src="online.gif" />'); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/180357-why-do-i-get-this-stupid-furecking-error-misspelled-on-purpose/ Share on other sites More sharing options...
waynew Posted November 5, 2009 Share Posted November 5, 2009 What's coming in through $_POST['ip'] and how are you so sure that something is coming through $_POST['ip'] at all? Quote Link to comment https://forums.phpfreaks.com/topic/180357-why-do-i-get-this-stupid-furecking-error-misspelled-on-purpose/#findComment-951431 Share on other sites More sharing options...
3raser Posted November 5, 2009 Author Share Posted November 5, 2009 http://webmasters.webatu.com/ Quote Link to comment https://forums.phpfreaks.com/topic/180357-why-do-i-get-this-stupid-furecking-error-misspelled-on-purpose/#findComment-951436 Share on other sites More sharing options...
3raser Posted November 5, 2009 Author Share Posted November 5, 2009 Wait, I fixed an error. I didn't have method="POST" but now I get this error: Warning: fsockopen() expects parameter 2 to be long, string given in /home/a9726309/public_html/server.php on line 5 Quote Link to comment https://forums.phpfreaks.com/topic/180357-why-do-i-get-this-stupid-furecking-error-misspelled-on-purpose/#findComment-951439 Share on other sites More sharing options...
waynew Posted November 5, 2009 Share Posted November 5, 2009 How are you making sure that the user entered something in those textfields? I didn't enter anything. I just hit enter and got brought to a page that said Warning: fsockopen() expects parameter 2 to be long, string given in /home/a9726309/public_html/server.php on line 5 Quote Link to comment https://forums.phpfreaks.com/topic/180357-why-do-i-get-this-stupid-furecking-error-misspelled-on-purpose/#findComment-951441 Share on other sites More sharing options...
3raser Posted November 5, 2009 Author Share Posted November 5, 2009 Why the hell doesn't it work anyways? I currently don't care about if the user has entered something. I just want to get the damn thing working. And when ever I enter random information it keeps saying it's online. WTF? New code: <?php $server = $_POST['ip']; $port = $_POST['port']; if (!$server || !$port) die ("One of the required fields has not been filled out!"); $status = fsockopen( 'udp://' . $server, $port, $errno, $errstr, 3 ); if ( !$status ) { die('<img src="offline.png" />'); } else { die('<img src="online.png" />'); } ?> Same error as before. Quote Link to comment https://forums.phpfreaks.com/topic/180357-why-do-i-get-this-stupid-furecking-error-misspelled-on-purpose/#findComment-951443 Share on other sites More sharing options...
waynew Posted November 5, 2009 Share Posted November 5, 2009 Are you not specifying a port? You have $port as a variable, but I don't see it being set. Usually, it's supposed to be 80. Quote Link to comment https://forums.phpfreaks.com/topic/180357-why-do-i-get-this-stupid-furecking-error-misspelled-on-purpose/#findComment-951444 Share on other sites More sharing options...
waynew Posted November 5, 2009 Share Posted November 5, 2009 My apologies. I forgot that you're using udp: http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers Quote Link to comment https://forums.phpfreaks.com/topic/180357-why-do-i-get-this-stupid-furecking-error-misspelled-on-purpose/#findComment-951448 Share on other sites More sharing options...
MadTechie Posted November 5, 2009 Share Posted November 5, 2009 Warning: fsockopen() expects parameter 2 to be long, string given in /home/a9726309/public_html/server.php on line 5 2nd parameter is port... it expects a long and your passing a string! just convert it to an int ie $port = (int)$_POST['port']; Quote Link to comment https://forums.phpfreaks.com/topic/180357-why-do-i-get-this-stupid-furecking-error-misspelled-on-purpose/#findComment-951450 Share on other sites More sharing options...
MadTechie Posted November 5, 2009 Share Posted November 5, 2009 Why the hell doesn't it work anyways? Define working.. it does exactly what you asked it to do.. what where you expecting ? Quote Link to comment https://forums.phpfreaks.com/topic/180357-why-do-i-get-this-stupid-furecking-error-misspelled-on-purpose/#findComment-951457 Share on other sites More sharing options...
3raser Posted November 5, 2009 Author Share Posted November 5, 2009 I mean when I type in aaa for the IP and 5555 for the port, it gives me an online message. o.O? Quote Link to comment https://forums.phpfreaks.com/topic/180357-why-do-i-get-this-stupid-furecking-error-misspelled-on-purpose/#findComment-951458 Share on other sites More sharing options...
MadTechie Posted November 5, 2009 Share Posted November 5, 2009 works here! Quote Link to comment https://forums.phpfreaks.com/topic/180357-why-do-i-get-this-stupid-furecking-error-misspelled-on-purpose/#findComment-951468 Share on other sites More sharing options...
3raser Posted November 5, 2009 Author Share Posted November 5, 2009 MadTechie, no it doesn't. It's suppose to display an OFFLINE message if it's offline or false information....... Quote Link to comment https://forums.phpfreaks.com/topic/180357-why-do-i-get-this-stupid-furecking-error-misspelled-on-purpose/#findComment-951477 Share on other sites More sharing options...
MadTechie Posted November 5, 2009 Share Posted November 5, 2009 I said HERE meaning on MY PC. Code is fine, check server logs (also you may want to turn error reporting on.. during testing) Quote Link to comment https://forums.phpfreaks.com/topic/180357-why-do-i-get-this-stupid-furecking-error-misspelled-on-purpose/#findComment-951479 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.