Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP curl, special network interface

I have a (Webserver)Server with two network interfaces. The first is the standard interface with the public internet connection, the other is a virtual VPN-networkinterface.

Now I want to send POST data via curl on an other Webservice within the VPN-Network.

How I can say the php there have to call the address with the VPN-Networkinterface?

like image 312
Denis Avatar asked Oct 19 '25 01:10

Denis


1 Answers

The documentation lists CURLOPT_INTERFACE as a configurable option.

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

curl_setopt($ch, CURLOPT_INTERFACE, "XXX.XXX.XXX.XXX");
like image 91
Scuzzy Avatar answered Oct 21 '25 14:10

Scuzzy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!