RE: help why can't i connect to the net

From: Date: Tue, 14 Nov 2000 03:28:57 +0000
Subject: RE: help why can't i connect to the net
Groups: php.general 
Request: Send a blank email to php-general+get-25108@lists.php.net to get a copy of this message
Have you spelt fsockopen correctly? fsockopen, not fscokopen ;) Have you tried error checking on the open? (see below for example) Have you tried set socket blocking? (you may need it on your connection) Try this (untested) to see what you're getting back. function OpenCon($hostname,$port){ global $connection; if(hostname=="") return("2 it was not specified a valid hostname"); switch(($connection=fsockopen($hostname,$port))) { case -3: return("-3 socket could not be created"); case -4: return("-4 dns lookup on hostname \"$hostname\" failed"); case -5: return("-5 connection refused or timed out"); case -6: return("-6 fdopen() call failed"); case -7: return("-7 setvbuf() call failed"); default: //let getline do its job bit by bit rather than timeout by timeout ;) set_socket_blocking ($connection,false); return(""); } } $connection=0; $buffer=512; $timeout=30; $iStartTime = time(); set_socket_blocking($connection, false); print OpenCon ( "pop.mail.yahoo.com",110 ); $line = fread($connection,128); while(empty($line)){ $line = fread($connection,128); usleep(250000); } print $line; -----Original Message----- From: sunyan [mailto:forestwater@sina.com.cn] Sent: November 14, 2000 11:14 AM To: Lawrence.Sheed@dfait-maeci.gc.ca Subject: help why can't i connect to the net I use the function "fscokopen()" to connect to net. But it can't work. I write like this : fscokopen("pop.mail.yahoo.com",110); I try it with telnet ,the address is right. please help me!!!

« previous php.general (#25108) next »