Skip to content

Instantly share code, notes, and snippets.

@coderua
Created February 13, 2016 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coderua/7df5f18c40f347bdd9a1 to your computer and use it in GitHub Desktop.
Save coderua/7df5f18c40f347bdd9a1 to your computer and use it in GitHub Desktop.
Curl testing stub
<?php
/**
* Curl testing stub
*/
$url = '';
$userAgent = 'User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36';
$headers = array();
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($ch, CURLOPT_PORT, 443);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
//curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
//curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
echo "Response code: " . curl_getinfo($ch, CURLINFO_HTTP_CODE) . "\n";
print_r(curl_getinfo($ch));
print_r($result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment