我使用bitbly API来缩短url。
下面是我使用的一段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": ""}
我不能为我的生活,理解为什么比特返回那个错误-特别是因为我正在传递api密钥-给了什么?
参数为apiKey
,不是apikey