Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
PHP script to scrape data from a gist page
function get_gist_url($id) {
$data = file_get_contents("$id");
$pos1 = strpos($data, "/raw/$id");
$pos2 = strpos($data, "\"", $pos1);
$url = substr($data, $pos1, $pos2-$pos1);
return "$url";
$url = get_gist_url($_GET["id"]);
echo file_get_contents($url);
echo "\n# $url\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment