CURL via OpenVPN or PPTP

Is there a way to make cURL requests through a VPN such as OpenVPN or PPTP?

I know that I can use a proxy, but the VPN is different.

+8
php curl
source share
2 answers

cURL simply uses the network stack of the operating system and does not implement TCP (or lower level protocols).

Therefore, it works great when the operating system is configured to route network communications through a virtual adapter, regardless of how the adapter is implemented.

+5
source share

EDITOR: JULY 2013

I received several letters about this, so I wrapped it all up in the blogpost: http://www.georgiecasey.com/2013/07/26/how-to-use-overplay-and-other-vpns-as-a- curl-proxy /


Yes, but you must first configure the VPN on a separate interface so that the entire server does not use a VPN. I'm not an OpenVPN expert, but I did it with the dev switch to specify the virtual network device TUN / TAP: dev proxy1 . Additional information on the OpenVPN man page.

Then use this line of PHP code in your scripts.

 curl_setopt($ch, CURLOPT_INTERFACE, "proxy1"); 

I did this so that I can use all of the overplay.net IP addresses to clear the files on my server. These IP addresses change often, so I have a cronjob that pulled out a zip IP address file, created an OpenVPN configuration file for each IP address, started every VPN and put all the IP addresses and interface names in a DB table. Then my scripts just pulled out random interface names from the database and used this in curl. He worked with pleasure.

+11
source share

All Articles