copy this function into your code function get_googl($url){ $apikey = ‘yourApiKeyFromGoogle’; $asset = array(‘longUrl’ => $url); $object = json_encode($asset); $google = ‘https://www.googleapis.com/urlshortener/v1/url?key=’.$apikey; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $google); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-type:application/json’)); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $object); $data = curl_exec($ch); curl_close($ch); $response = json_decode($data); $resulturl = $response->id; return $resulturl; } then using this function <?php echo … Continue reading Create Function Google Shorterner