我正在使用 bitbly API 来缩短网址。
这是我正在使用的 PHP 代码片段。
<?php
$bitly = 'http://api.bit.ly/shorten?version='.$version.'&longurl='.urlencode($url).'&login='.$login.'&apikey='.$appkey.'&format='.$format;
//The above string evaluates to:
http://api.bit.ly/shorten?version=&longurl=http://real.address.replace&login=myname&apikey=A_key_provided_by_bitbly&format=json
$response = file_get_contents($bitly);
$json = @json_decode($response,true);
}
当我调用它时,我得到以下 JSON 响应:
{"errorCode": 500, "errorMessage": "MISSING_ARG_APIKEY", "results": null, "statusCode": ""}
我不能为我的生活,理解为什么 bitly 返回那个错误 - 特别是因为我正在传递 api 密钥 - 什么给了?