Skip to content

Instantly share code, notes, and snippets.

@MarkoKaartinen
Created February 3, 2017 06:39
Show Gist options
  • Save MarkoKaartinen/3e2e9cb39fc909700fa8923f253c2aca to your computer and use it in GitHub Desktop.
Save MarkoKaartinen/3e2e9cb39fc909700fa8923f253c2aca to your computer and use it in GitHub Desktop.
Lyhyt.fi esimerkki (info)
<?php
$ch = curl_init('https://lyhyt.fi/api/info');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// headers
$headers = [
'Authorization: Bearer APITOKEN',
'Accept: application/json'
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// if using POST
curl_setopt($ch,CURLOPT_POST, 1);
$postdata = array(
'slug' => 'Z9E270aIId'
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
$response = curl_exec($ch);
curl_close($ch);
echo "<pre>";
print_r($response);
echo "</pre>";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment