Geçtiğimiz günlerde forumda sorulan bir soruydu. Cevap php'nin manual sitesinde zaten hazır olarak verilmişti. curl ve file_get_contents fonksiyonları altına yorum yapanların verdikleri bilgileri gözönüne alarak curl'ün file_get_contents'den daha hızlı çalıştığını söyleyebiliriz.
Test sonuçlarına geçeçek olursak;
İlk testi yapan üye, 20 adet farklı web sitesine 10'ar kere istek göndermiş. Alınan sonuçlar aşağıdaki gibi listelenmiş.
Curl: 43.02 saniye
FGC: 86.48 saniye
Fopen: 86.34 saniye
Socket: 44.91 saniye
Ikinci testi yapan üye ise yine farklı sitelere bağlantı açıyor. Sonuçları;
http://www.flickr.com/ sitesine 50 sorgu,
cURL ile 9.550734 saniye.
file_get_contents() ile 10.878360 saniye.
http://www.yahoo.com/ sitesine 50 sorgu,
cURL ile 4.729566 saniye.
file_get_contents() ile 10.443786 saniye.
http://www.ebay.com/ sitesine 50 sorgu,
cURL ile 46.348250 saniye.
file_get_contents() ile 52.685604 saniye.
http://www.godaddy.com/ sitesine 50 sorgu,
cURL ile 1.505460 saniye.
file_get_contents() ile 37.154304 saniye.
http://www.php.net/ sitesine 50 sorgu,
cURL ile 13.136836 saniye.
file_get_contents() ile 17.981879 saniye.
Test sonuçlarına geçeçek olursak;
İlk testi yapan üye, 20 adet farklı web sitesine 10'ar kere istek göndermiş. Alınan sonuçlar aşağıdaki gibi listelenmiş.
Curl: 43.02 saniye
FGC: 86.48 saniye
Fopen: 86.34 saniye
Socket: 44.91 saniye
Ikinci testi yapan üye ise yine farklı sitelere bağlantı açıyor. Sonuçları;
http://www.flickr.com/ sitesine 50 sorgu,
cURL ile 9.550734 saniye.
file_get_contents() ile 10.878360 saniye.
http://www.yahoo.com/ sitesine 50 sorgu,
cURL ile 4.729566 saniye.
file_get_contents() ile 10.443786 saniye.
http://www.ebay.com/ sitesine 50 sorgu,
cURL ile 46.348250 saniye.
file_get_contents() ile 52.685604 saniye.
http://www.godaddy.com/ sitesine 50 sorgu,
cURL ile 1.505460 saniye.
file_get_contents() ile 37.154304 saniye.
http://www.php.net/ sitesine 50 sorgu,
cURL ile 13.136836 saniye.
file_get_contents() ile 17.981879 saniye.