Created
February 3, 2017 06:31
-
-
Save MarkoKaartinen/c78ecb5234e89cdb3000416a5f43103f to your computer and use it in GitHub Desktop.
Lyhyt.fi esimerkki (shorten)
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/shorten'); | |
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( | |
'url' => 'https://keskustelu.it-nurkka.fi/t/mista-tunnistaa-roskapostin/41' | |
); | |
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