php open_socket
- by sea_1987
Hello, I am trying to open a socket to use with secure tradings xpay api, however when I check to see if the socket is open I get error returned,
Can't assign requested address
I need to open up 127.0.0.1:5000 is there something wring with my code that means I cannot do this?
if (isset($xpay_port) and
($socket=socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) and
(socket_connect($socket, $address, $port)))
{
$text="Connection successful on IP $address, port $port";
socket_close($socket);
}
else
$text="Unable to connect<pre>".socket_strerror(socket_last_error())."</pre>";
echo "<html><head></head><body>".
$text.
"</body></html>";