Created
July 23, 2012 14:11
-
-
Save trico/3163810 to your computer and use it in GitHub Desktop.
Curl php proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = 'url'; | |
$proxyauth = 'user:pass'; | |
$proxy = 'proxy.server.es'; | |
$proxyPort = '8080'; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
//proxy suport | |
curl_setopt($ch, CURLOPT_PROXY, $proxy); | |
curl_setopt($ch, CURLOPT_PROXYPORT, $proxyPort); | |
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth); | |
curl_setopt($ch, CURLOPT_PROXYTYPE, 'HTTP'); | |
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); | |
//https | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |
curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0"); | |
curl_setopt($ch, CURLOPT_HEADER, 0); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_TIMEOUT, 100); | |
$output = curl_exec($ch); | |
curl_close($ch); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment