Skip to main content
All CollectionsHow to Use Guides
How to use HTTP/SOCKS Proxies in PHP Code using Limeproxies?
How to use HTTP/SOCKS Proxies in PHP Code using Limeproxies?
Steve M avatar
Written by Steve M
Updated over 3 years ago

How to use HTTP/SOCKS Proxies in PHP Code using Limeproxies?

Our proxies are suited for use in PHP scripts with curl, a few PHP code snippets are listed below. Your proxies are delivered as PROXY_IP:PORT_NUMBER like for example 31.220.8.9:1212 so in these examples 31.220.8.9 would be the IP and 1212 would be the port number. 1212 is the default port for all Limeproxies HTTP/HTTPS proxies. For SOCKS, it will be a random number every time you turn OFF and ON the SOCKS.

Note: Before using our proxies, ensure that your server IP address is authorized via the proxy panel if you are using IP-based authentication.

HTTP Proxies

$curl=curl_init();

curl_setopt($curl,CURLOPT_TIMEOUT,20);

curl_setopt($curl,CURLOPT_FOLLOWLOCATION,1);

curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);

curl_setopt($curl,CURLOPT_PROXYTYPE,CURLPROXY_HTTP);

curl_setopt($curl,CURLOPT_PROXY,'31.220.8.9');

curl_setopt($curl,CURLOPT_PROXYPORT,'1080');

curl_setopt($curl,CURLOPT_PROXYUSERPWD,'user-xxxxx:password');

curl_setopt($curl,CURLOPT_URL,'http://www.urlto.get');

$content=curl_exec($curl);

SOCKS proxies

$curl = curl_init();

curl_setopt($curl, CURLOPT_TIMEOUT, 20);

curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);

curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);

curl_setopt($curl,CURLOPT_PROXY,'31.220.8.9');

curl_setopt($curl,CURLOPT_PROXYPORT,'xxxxx');

curl_setopt($curl, CURLOPT_URL, 'http://www.limeproxies.com/anonymity.php');

$content = curl_exec($curl);

Did this answer your question?