Tuesday, June 5, 2012

file_get_contents VS CURL, what has better performance?


I am using PHP to build a web crawler to crawl millions of URLs, what is better for me in terms of performance? file_get_contents or CURL ?



Thanks.


Source: Tips4all

1 comment:

  1. I just did some quick benchmarking on this.

    Fetching google.com using file_get_contents took (in seconds):

    2.31319094
    2.30374217
    2.21512604
    3.30553889
    2.30124092

    CURL took:

    0.68719101
    0.64675593
    0.64326
    0.81983113
    0.63956594

    This was using the benchmark class from http://davidwalsh.name/php-timer-benchmark

    ReplyDelete