Created
June 29, 2015 01:00
-
-
Save hassansin/08fd6616b6be2c70f9e3 to your computer and use it in GitHub Desktop.
PHP cURL Snippets
This file contains hidden or 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
/*Use Fiddler Proxy*/ | |
curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:8888'); | |
/*Use Proxy*/ | |
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); | |
curl_setopt($ch, CURLOPT_PROXY, "IP:PORT"); | |
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "username:password"); | |
/*SSL Request*/ | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |
//curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); | |
/*Set Headers*/ | |
curl_setopt($process, CURLOPT_REFERER, $referer); // Referere Header | |
curl_setopt($process, CURLOPT_USERAGENT, $userAgent); // User-Agent Header` | |
curl_setopt($process, CURLOPT_ENCODING , 'gzip, deflate'); //Accept-Encoding Header | |
curl_setopt($process, CURLOPT_HTTPHEADER, $headers); // Other Headers | |
/*Use Cookies*/ | |
$cookie_file = tempnam("/tmp", "cookie") | |
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file); | |
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment