我正在尝试使下面的代码与 curl 或其他东西一起使用。我已经看过 curl fsockopen 转换,但它不起作用。除了在我的主机上禁用 fsockopen 之外,该代码有效。任何帮助将不胜感激。
$host = substr($hostport,0,50);
$port = substr($hostport,50,10);
$issecure = substr($hostport,60,1);
if($issecure=="Y")
{
$host = "ssl://".$host;
}
$fsok = fsockopen(trim($host) , intval(trim($port)));
if(FALSE == $fsok )
{
echo "Target Host not Found/Down"; return ;
}
fwrite($fsok, $bodyData );
$port ='';$host ='';$hostport= '';$bodyData='';
while ($line = fread($fsok, 25000))
{
echo $line;
}
fclose($fsok);
return $line;