Skip to content

Instantly share code, notes, and snippets.

@jennschiffer
Created August 27, 2015 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jennschiffer/2160d9b072aaf74d8266 to your computer and use it in GitHub Desktop.
Save jennschiffer/2160d9b072aaf74d8266 to your computer and use it in GitHub Desktop.
get gists w/ curl, used in gistless
<?php
/*
* uses curl to get the content of a gist
*
* @param string $gistUrl
* @return string
*/
function getGist($gistUrl) {
$curl = curl_init();
curl_setopt($curl,CURLOPT_USERAGENT,'jennschiffer');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_URL, $gistUrl);
$result = curl_exec($curl);
curl_close($curl);
return $result;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment