开发者

Which is faster? Using PHP's cUrl library or invoking curl utility form shell_exec()

For a PHP project i have to access RESTful API. I was using curl to get familiar with the API. I can access the开发者_StackOverflow said API using both PHP's cUrl library and invoking the curl utility using PHP's shell_exec() function. Performance wise, which option would be better and why??

PS: I have my own server with root privilege.


My cautious guess would be not too useful test snippets shows that the curl library is more performant.

Edit: A little test shows, that the library is faster, but not by much. Also, if you fetch millions of URLs, network latency will more likely be a bigger problem.


Performance is pretty much exactly the same, because the same stuff is being executed internally. But you should use the API because it is cleaner.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜