alcane
alcane

Reputation: 11

Determine IP address used by cURL in PHP

If i'm using PHP cURL with a Socks5 to connect to a site, is it possible to retrieve the IP sent by cURL ? for example like that :

$socks = "XXX.XXX.XXX.XXX:12345";
curl_setopt($curl, CURLOPT_PROXY, $socks);
curl_setopt($curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($curl, CURLOPT_URL, "http://www.google.com");

XXX.XXX.XXX.XXX:12345 can be a tunnel to another IP YYYY.YYYY.YYYY.YYY, so i need to ask if it is possible to retrieve the IP that will send request to google.com.

Upvotes: 0

Views: 339

Answers (1)

Jon
Jon

Reputation: 437336

It isn't possible.

The request will be made by the SOCKS proxy, and the contract between you and the proxy does not include the option of retrieving information about the network interfaces the proxy uses to forward requests.

Upvotes: 1

Related Questions