note 75126 deleted from ref.curl by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 19:17:44 +0000 |
| Subject: | note 75126 deleted from ref.curl by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155222@lists.php.net to get a copy of this message | ||
Note Submitter: trucex at gmail dot com
----
Many people still use the fopen wrappers, file_get_contents(), or even include() to open files
across the internet. The issue with this is that they were not designed to do so and they are
inefficient in doing so. Curl is a great alternative to these and isn't much harder to use. It
even beats out the use of sockets in fairly default configurations.
I have created a script that tests all 4 methods on 20 different websites 10 times each. The results
are clear, here is one set of the results:
Curl time: 43.02 seconds
FGC time: 86.48 seconds
Fopen time: 86.34 seconds
Socket time: 44.91 seconds
As you can see, there is little performance difference between file_get_contents and fopen/fread.
Likewise, there is little difference between curl and sockets.
You may use the test to see the results in realtime if you'd like: http://trucex.com/curltest.php