James Vince
James Vince

Reputation: 11

Which is quicker cURL or fsockopen?

I need to call two or three known URLs really quickly. I am writing a command line app where speed is imperative!

Does curl open a socket itself?

Are there any benchmarks?

Upvotes: 1

Views: 5177

Answers (1)

AKX
AKX

Reputation: 169388

I'd say you're better off using cURL (yes, it opens its own sockets), because it knows HTTP better than cobbling a non-standard client together with fsockopen() and friends probably will.

And well - if you're absolutely serious about needing blazing fast HTTP-loadin' performance (define "really quickly"), you'll have to use something other than PHP.

EDIT: Do the pages change often? If not, (mem)cache their contents locally and you shouldn't have too much problems.

Upvotes: 2

Related Questions