Skip to content

Instantly share code, notes, and snippets.

View linuxman's full-sized avatar

LinuxmanR4 linuxman

View GitHub Profile
@marijn
marijn / unshorten.php
Created October 16, 2012 20:52
Unshorten URLS with PHP and CURL
<?php
/**
* @link http://jonathonhill.net/2012-05-18/unshorten-urls-with-php-and-curl/
*/
function unshorten_url($url) {
$ch = curl_init($url);
curl_setopt_array($ch, array(
CURLOPT_FOLLOWLOCATION => TRUE, // the magic sauce
CURLOPT_RETURNTRANSFER => TRUE,