- // Connect to the destination
- socket_connect($socket, $dest, $port);
+ // Prepare the GET request
+ $request = 'GET /ip.php HTTP/1.0' . self::HTTP_EOL;
+ $request .= 'Host: www.ship-simu.org' . self::HTTP_EOL;
+ $request .= 'User-Agent: ' . self::HTTP_USER_AGENT . self::HTTP_EOL;
+ $request .= 'Connection: close' . self::HTTP_EOL;
+ $request .= self::HTTP_EOL;
+
+ // Send it to the socket
+ fwrite($socket, $request);
+
+ // Init IP (this will always be the last line)
+ $externalAddress = 'invalid';