Skip to content

Instantly share code, notes, and snippets.

@biggora
Last active May 18, 2016 18:48
Show Gist options
  • Save biggora/70de9b6e11ea253eb370975457b58882 to your computer and use it in GitHub Desktop.
Save biggora/70de9b6e11ea253eb370975457b58882 to your computer and use it in GitHub Desktop.
<?php
// config params
$conf = file_get_contents("/path/to/config.json");
// query string params
$qstr = $_GET;
// API params
$apiurl = "https://www.google.com";
$apiver = 3;
$apikey = "";
$secret = "";
$expire = 300;
/**
* BASE64
* base64_encode ( $data )
*
* HMAC SHA1
* hash_hmac ( "sha1" , $data , $key )
*
**/
// Initiate curl
$ch = curl_init();
// Add headers
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json")
// Disable SSL verification
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// Will return the response, if false it print the response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Set the url
curl_setopt($ch, CURLOPT_URL, $url);
// Execute
$result = curl_exec($ch);
// TODO: implement any logic
// echo json_decode($result, true)
// Closing
curl_close($ch);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment