Skip to content

Instantly share code, notes, and snippets.

@cthos
Created April 2, 2012 19:42
Show Gist options
  • Save cthos/2286656 to your computer and use it in GitHub Desktop.
Save cthos/2286656 to your computer and use it in GitHub Desktop.
Get Raw Gist from Curl
<?php
$test_url = 'https://gist.github.com/2286656';
$bits = explode('/', $test_url);
$id = array_pop($bits);
$raw_url = 'https://raw.github.com/gist/' . $id;
$ch = curl_init($raw_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
var_dump($output); // That's the raw gist, I think for the latest iteration
@cthos
Copy link
Author

cthos commented Apr 2, 2012 via email

@feffi
Copy link

feffi commented Apr 16, 2013

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment