Skip to content

Instantly share code, notes, and snippets.

@svdmitrij
Last active August 29, 2015 14:04
Show Gist options
  • Save svdmitrij/235c7fb0965213aa1d4b to your computer and use it in GitHub Desktop.
Save svdmitrij/235c7fb0965213aa1d4b to your computer and use it in GitHub Desktop.
Test curl connection
<?php
$_h = curl_init();
curl_setopt($_h, CURLOPT_HEADER, 1);
curl_setopt($_h, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($_h, CURLOPT_HTTPGET, 1);
curl_setopt($_h, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($_h, CURLOPT_URL, 'TESTING_URL' ); // Change TESTING_URL on url that you want to test.
curl_setopt($_h, CURLOPT_DNS_USE_GLOBAL_CACHE, false );
curl_setopt($_h, CURLOPT_DNS_CACHE_TIMEOUT, 2 );
var_dump(curl_exec($_h));
var_dump(curl_getinfo($_h));
var_dump(curl_error($_h));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment