php - How to prevent Goo.gl opens links via API? -
i'm using goo.gl service shorten registered users activation link. once user clicks link gets activated. noticed new registered users automatically activated after shortening activation link. i've stopped shortening service , send long url , works fine without getting activated means urls send goo.gl opened. there way prevent goo.gl opening links while shortening via api? if not what's service can count on instead of google?
$apikey = 'key'; $postdata = array('longurl' => $longurl); $jsondata = json_encode($postdata); $curlobj = curl_init(); curl_setopt($curlobj, curlopt_url, 'https://www.googleapis.com/urlshortener/v1/url?key=' . $apikey); curl_setopt($curlobj, curlopt_returntransfer, 1); curl_setopt($curlobj, curlopt_ssl_verifypeer, 0); curl_setopt($curlobj, curlopt_header, 0); curl_setopt($curlobj, curlopt_httpheader, array('content-type:application/json')); curl_setopt($curlobj, curlopt_post, 1); curl_setopt($curlobj, curlopt_postfields, $jsondata); $response = curl_exec($curlobj); $json = json_decode($response); curl_close($curlobj); if (strlen(trim($json->id)) > 0) { return $json->id; } else { return $longurl; }
wiki
Comments
Post a Comment