Friday, January 9, 2009

Fetching data from telnet connection using PHP

Fetching data from telnet connection using PHP is very simple.we can use PHP socket functions for this purpose.This is the example code.
$fp = fsockopen("www.sportsinweb.com", 80, $errno, $errstr, 30);
if(!$fp ){
echo "ERROR: $errno - $errstr
\n";
}
else
{
while (!feof($fp))
{
echo fgets($fp, 128);
// You can receive it to a string and can process instead of echo
}
fclose($fp);
}

No comments:

Post a Comment