Skip to content

Instantly share code, notes, and snippets.

@phpfunk
Created May 20, 2014 13:48
Show Gist options
  • Save phpfunk/56dc88224ce31dcbbc4f to your computer and use it in GitHub Desktop.
Save phpfunk/56dc88224ce31dcbbc4f to your computer and use it in GitHub Desktop.
cURL Headers Only
<?php
$url = 'https://camo.githubusercontent.com/2fae166c7f5cb63b11857915f94a9c094534b7bd/687474703a2f2f636c2e6c792f696d6167652f306c3368316c3079315130392f53637265656e25323053686f74253230323031342d30352d3134253230617425323031302e30302e3436253230414d2e706e67';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD');
$result = curl_exec($ch);
$info = curl_getinfo($ch);
$error = curl_error($ch);
curl_close($ch);
echo $result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment