Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

How do you compare CURL and Socket programming in PHP? What are the pros and cons of both? And why do you prefer one over the other?

<p>I was just wondering that we may be able to achieve the same thing using both of these methods i.e. CURL or Socket. Has anybody tried to compare these two on performance, and any other parameters? </p>

user-image
Question ajoutée par Atif Majid , Senior PHP Programer/Team Lead , RedApple Apartments AB
Date de publication: 2014/11/01
Majid Hameed
par Majid Hameed , Senior Java Developer , Check24 Vergleichsportal GmbH

* Socket performs better as compared to Curl.

* Usage wise Curl is better as compared to Socket.

* If you want to connect to machines over internet on different non standard ports using Sockets you might have to deal with security issues; firewall etc.

* Hosting support might be another factor but its very minimal.

Performance Statistics - Source: http://goo.gl/3q9oZ9

Muhammad Majid Saleem
par Muhammad Majid Saleem , Senior PHP Developer / Project Manager , SwaamTech

I believe, both have their own advantages and disadvantages over each other. But I would suggest to user cURL.

 

I would recommend, you are better off using cURL because:

- It knows HTTP better than fsockopen().

- It opens its own sockets.

- It is well friend of HTTP probably.

- It has standard client to perform its actions.

 

Here is good compression between PHP cURL and PHP Socket: http://sysmagazine.com/posts/166633/

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?