Created
November 15, 2016 21:26
-
-
Save gugu/b2d9dd70e5b2f7df2343d5fc1be4718f to your computer and use it in GitHub Desktop.
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
<? | |
$url = "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; | |
$escaped_url = htmlspecialchars( $url, ENT_QUOTES, 'UTF-8' ); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, "https://api.short.cm/links"); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); | |
curl_setopt($ch, CURLOPT_HEADER, FALSE); | |
curl_setopt($ch, CURLOPT_POST, TRUE); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ | |
\"domain\": \"tuneup.fit\", | |
\"originalURL\": \"$url\", | |
\"path\": \"\", | |
\"title\": \"\" | |
}"); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array( | |
"Content-Type: application/json", | |
"Authorization: yPsWQcKyOlRZVpia" | |
)); | |
$response = curl_exec($ch); | |
curl_close($ch); | |
var_dump($response); | |
echo '<input type="text" class="form-control" id="select-this"" value="' . $response . '">'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment