note 75126 added to ref.curl
| From: | trucex at gmail dot com | Date: | Mon, 14 May 2007 03:51:06 +0000 |
| Subject: | note 75126 added to ref.curl | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-126573@lists.php.net to get a copy of this message | ||
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
----
Server IP: 64.71.164.2
Probable Submitter: 68.84.197.115
----
Manual Page -- http://www.php.net/manual/en/ref.curl.php
Edit -- https://master.php.net/note/edit/75126
Del: integrated -- https://master.php.net/note/delete/75126/integrated
Del: useless -- https://master.php.net/note/delete/75126/useless
Del: bad code -- https://master.php.net/note/delete/75126/bad+code
Del: spam -- https://master.php.net/note/delete/75126/spam
Del: non-english -- https://master.php.net/note/delete/75126/non-english
Del: in docs -- https://master.php.net/note/delete/75126/in+docs
Del: other reasons-- https://master.php.net/note/delete/75126
Reject -- https://master.php.net/note/reject/75126
Search -- https://master.php.net/manage/user-notes.php