| Server IP : 172.67.216.113 / Your IP : 172.71.28.146 [ Web Server : Apache System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64 User : cp648411 ( 1354) PHP Version : 7.2.34 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home2/cp648411/public_html/simded.com/horo/daily/mybackend/include/ |
Upload File : |
<?php
$curl = curl_init();
$originalURL = $_GET["q"];
$authorization = 'sk_Ynma9KmCs92z64UN'; //true
$domain = 'simded.short.gy'; //true
//$authorization = 'sk_mUEmboYVr0FOGCrW'; //test
//$domain = 'simt.short.gy'; //test
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.short.io/links",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode(array(
'originalURL' => $originalURL,
'domain' => $domain
)),
CURLOPT_HTTPHEADER => array(
"authorization: $authorization",
"content-type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
$response = json_decode($response, JSON_UNESCAPED_UNICODE );
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response['shortURL'];
}