访问REST API时,这两段代码有何不同?
$result = file_get_contents('http://api.bitly.com/v3/shorten?login=user&apiKey=key&longUrl=url');
和
$ch = curl_init('http://api.bitly.com/v3/shorten?login=user&apiKey=key&longUrl=url');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
从以下两个方面判断,它们都产生相同的结果
print_r(json_decode($result))
慕尼黑5688855
BIG阳