Kilho oh2019-07-26T00:27:30+09:00I needed a short link, so I made it PHP.
You can use it after registering Google API.
How to use: Shortur_google ('original address', 'API key');
<? PHP
Function Shortur_google ($ URL, $ Key)
{
$ post = array ('LONGURL' => $ URL);
$ json = json_encode ($ post);
$ curlobj = curl_init ();
curl_setopt ($ curlobj, curlopt_url, 'https://www.googleapis.com/urlshortener/v1/url?key='..nkey);
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, $ json);
$ json = json_decode (curl_exec ($ curlobj));
curl_close ($ curlobj);
return $ json-> ID;
}
Echo Shortur_google ('http://kalmuri.kilho.net/', 'API-KEY-API-KEY-Api-Key');
?>