PHP Difference between Curl and HttpRequest

前端 未结 3 1468
半阙折子戏
半阙折子戏 2020-12-10 10:34

I have a need to do RAW POST (PUT a $var) requests to a server, and accept the results from that page as a string. Also need to add custom HTTP header information (like x-ex

3条回答
  •  悲哀的现实
    2020-12-10 11:20

    Curl is bundled with PHP, HTTPRequest is a separate PECL extension.

    As such, it's much more likely that CURL will be installed on your target platform, which is pretty much the deciding factor for most projects. I'd only consider using HTTPRequest if you plan to only ever install your software on servers you personally have the ability to install PECL extensions on; if your clients will be doing their own installations, installing PECL extensions is usually out of the question.

    This page seems to suggest that HTTPRequest uses CURL under the hood anyway. Sounds like it might offer a slightly more elegant interface to curl_multi_*(), though.

提交回复
热议问题