cURL Vs Socket

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

hi all,

I need to POST values from PHP ie through code to a page on the net.
AFAIK there seems to be two methods of doing so, first you can use CURL
[ curl_exec() ] and secondly open a socket [ fsockopen() ].

So guys, in terms of performance what method would be best to use? Or
what are the pros n cons of using these methods.


Re: cURL Vs Socket

*** Vish wrote/escribió (15 Jun 2005 01:27:40 -0700):
Quoted text here. Click to load it

It'd be surprising that posting data through the Internet you faced any
performance issue related to choosing either method. 99,9% of your
performance will depend on network and remote server.

Use sockets if portability is a great issue and curl if you don't want to
reinvent the wheel.

-- Álvaro G. Vicario - Burgos, Spain
-- - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group

Re: cURL Vs Socket


on 06/15/2005 05:27 AM Vish said the following:
Quoted text here. Click to load it

Using socket connections is preferred not because performance reasons
but because cUrl library has problems dealing with certain kinds of servers.

You may want to take a look at this HTTP client class that can submits
and processes HTTP requests correctly. It can use the cURL library
transparently only for SSL requests, but if fsockopen supports SSL it
will be used instead of curl.


Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP /

PHP Reviews - Reviews of PHP books and other products /

Metastorage - Data object relational mapping layer generator

Site Timeline