PHP cURL vs file_get_contents
Czym różnią się te dwa fragmenty kodu podczas uzyskiwania dostępu do interfejsu API REST?
$result = file_get_contents('http://api.bitly.com/v3/shorten?login=user&apiKey=key&longUrl=url');
i
$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);
Oba dają taki sam wynik, sądząc po
print_r(json_decode($result))