Created
February 3, 2017 06:39
-
-
Save MarkoKaartinen/3e2e9cb39fc909700fa8923f253c2aca to your computer and use it in GitHub Desktop.
Lyhyt.fi esimerkki (info)
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 | |
$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