Created
December 7, 2012 22:37
-
-
Save cjroebuck/4237105 to your computer and use it in GitHub Desktop.
webshotr-v1.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function webshotr_v1($url, $args) | |
{ | |
$WEBSHOTR_APIKEY = "ca482d7e-9417-4569-90fe-80f7c5e1c781"; | |
$WEBSHOTR_SECRET = "d18ff559-8fc2-447f-8e8d-1b1157f9b1c2"; | |
$options['url'] = urlencode($url); | |
$options += $args; | |
foreach ($options as $key => $value) { | |
$_parts[] = "$key=$value"; | |
} | |
$query_string = implode("&", $_parts); | |
$TOKEN = hash_hmac("sha1", $query_string, $WEBSHOTR_SECRET); | |
return "http://api.webshotr.com/v1/$WEBSHOTR_APIKEY/$TOKEN/png/?$query_string"; | |
} | |
$options['width'] = "1024"; | |
$options['height'] = "768"; | |
$options['full_page'] = 'true'; | |
$options['force'] = 'true'; | |
$apicallUrl = webshotr_v1("google.com", $options); | |
echo $apicallUrl; | |
function getResource($url) | |
{ | |
// initialize a handle | |
$chandle = curl_init(); | |
// set URL | |
curl_setopt($chandle, CURLOPT_URL, $url); | |
// return results a s string | |
curl_setopt($chandle, CURLOPT_RETURNTRANSFER, 1); | |
// execute the call | |
$result = curl_exec($chandle); | |
curl_close($chandle); | |
return $result; | |
} | |
$content = getResource($apicallUrl); | |
echo $content; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment