select outgoing ip for curl request

You may want to try setting the CURLOPT_INTERFACE option:

curl_setopt($curlh, CURLOPT_INTERFACE, "xxx.xxx.xxx.xxx");

CURLOPT_INTERFACE: The name of the outgoing network interface to use. This can be an interface name, an IP address or a host name.

From: php Manual: curl_setopt


EDIT: Fixing example, as @Michael Hart pointed out pointed out in the other answer.

Leave a Comment