Am newbie to this, so might be asking a very simple question. Trying to run a simple php program using fsockopen
with variables. However it's failing with error:
php_network_getaddresses: getaddrinfo failed: Name or service not known
My code:
$A = 11.22.33.44
$H = sprintf('"%s"', $A);
echo "host
", $H;
$Y = '1234';
$Z = (int)$Y;
echo "port
" , $Z;
$fp = fsockopen($H, $Z, $errno, $errstr, 30);
It works fine with hard-coded values like fsockopen("11.22.33.44", 1234, $errno, $errstr, 30)
. Please suggest the fix.