/ Published in: PHP
I needed a simple function to shorten a link with goo.gl and wrote this, thought it may help someone. Note: you still need an API key from goo.gl
Expand |
Embed | Plain Text
function getgoogl($glurl, $apikey) { $ch = curl_init('https://www.googleapis.com/urlshortener/v1/url?key='.$apikey); CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, )); $chresults = json_decode(curl_exec($ch)); curl_close($ch); return $chresults->id; }
You need to login to post a comment.
