キルホああ2019-07-26T00:27:30+09:00短いリンクが必要だったので、PHPにしました。
Google APIを登録した後に使用できます。
使用方法:shortur_google( 'original dresdage'、 'api key');
<?php
関数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);
$ json-> idを返します。
}
echo shortur_google( 'http://kalmuri.kilho.net/'、 'api-key-pey-api-key');
?>