bitly not shortening url on server machine
I am usin开发者_如何学Cg the bitbly API to shorten urls.
here is a snippet of the PHP code I am using.
<?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);
}
When I invoke this, I get the following JSON response:
{"errorCode": 500, "errorMessage": "MISSING_ARG_APIKEY", "results": null, "statusCode": ""}
I can't for the life of me, understand why bitly is returning that error - especially since I am passing the api key - what gives?
The parameter is apiKey
, not apikey
.
精彩评论