function utf82unicode($str)
{
return iconv("utf-8", "UCS-2BE", $str);
}
function hex2str($hexstring)
{
$str = '';
for($i = 0, $len = strlen($hexstring); $i < $len; $i++)
{
$str .= sprintf("%02X", ord(substr($hexstring, $i, 1)));
}
return $str;
}
if($_POST['call'])
{
$all=$_POST['phone_call'];
}
if($_POST['stop'])
{
$all=$_POST['tel_uncall'];
}
if($_POST['send'])
{
$num=$_POST['meg_num'];
$msg=$_POST['msg'];
$msg=hex2str(utf82unicode($msg));
$all=$num."+".$msg;
}
$length=100;
$server_ip="192.168.1.50";
$port = 3333;
$sockfd=socket_create(AF_INET,SOCK_STREAM,SOL_TCP)or die("创建失败");
socket_connect($sockfd,$server_ip,$port)or die("连接失败");
socket_write($sockfd,$all,$length)or die("传送失败");
socket_close($socket);
echo ("");
exit();
?>
阅读(3168) | 评论(0) | 转发(0) |