Jump to content

The HTTP Extension


iwato

Recommended Posts

Question: Why is the HTTP extension not automatically configured?Quandary: It would appear that a very important part of PHP would be the handling of data from remote servers. Why would such a seemingly valuable extension not be automatically configured when PHP is installed?Roddy

Link to comment
Share on other sites

which http extension are you refering to?

Link to comment
Share on other sites

It's common to not have any extensions enabled by default, and expect the admin to enable them one-by-one and test each one to make sure everything works. If you install PHP and have everything enabled by default, and it won't run, it's hard to determine where the problem is. The HTTP extension in particular requires several other extensions on Windows, so instead of enabling 4 extensions by default they leave it up the server admin to decide if they want those enabled or not, and when to enable them. There's no reason to have everything enabled and loaded if you're not going to use it.

Link to comment
Share on other sites

It is interesting that there are so few contributor notes and very few examples in that section of the manual.
In my case, it is not included as part of the MAMP package. It must be additionally installed.Today I will attempt to install my first PECL extension.Roddy
Link to comment
Share on other sites

Are you suggesting cURL as a good alternative to HTTP?Roddy
as far as for what I needed to do for my latest website project, which included RESTful API calls to Facebook(w/OAuth)/Twitter/YouTube/Etsy then yes, it was a good alternative. I don't know enough about either one to know if there is/isn't any significant advantages/disadvantages to using one vs. the other however. I'm sure JSG can lay down the knowledge though.
Link to comment
Share on other sites

cURL is included with MAMP.
I just returned from the cURL website, whereupon I made a call to the get_loaded_extensions() function. The libcurl library did not appear. This library appears to be a requisite for the cURL extension.Roddy
Link to comment
Share on other sites

hmm, all I did to test if it is was available was to run phpinfo() and then look for it in the detailed output.

Link to comment
Share on other sites

The strange thing about PHP cURL is how most of the action is handled with the curl_setopt function, which is kind of annoying.I haven't made a thorough comparison, so I don't know exactly how they align. But I suspect that a lot of HTTP methods match the functionality of the various curl options. This would make HTTP an OOP alternative to cURL, I guess. And I imagine there are differences, too.The most common tasks I can think of are available in both libraries: making requests and setting their associated headers, sending post and get data, reading responses and response headers, etc. I haven't looked for more specialized stuff.

Link to comment
Share on other sites

The HTTP extension, for the most part, is a convinience wrapper for many other things PHP has as part of its core or in the cURL extension.Personally, I like it much more than the core stuff and cURL. I'm also baffled by the fact it's not enabled by default or on the very least included with PHP (waiting to be enabled; ala cURL).It's worth noting that the HTTP extension has a few functions that have no alternative in other extensions, like the http_parse_* and http_negotiate_* functions. Quite honestly, they were the reason for me to start using that extension in the first place... and using it for everything else too in the process.

Link to comment
Share on other sites

hmm, all I did to test if it is was available was to run phpinfo() and then look for it in the detailed output.
The cURL extension is present; but libcurl does not appear.On the cURL website they appear to be two separate software packages. Or, have I misunderstood?Roddy
Link to comment
Share on other sites

The cURL extension is present; but libcurl does not appear.On the cURL website they appear to be two separate software packages. Or, have I misunderstood?Roddy
If you try to compile from source, yes. If you use the PECL installer, it should download all required libraries.
Link to comment
Share on other sites

The HTTP extension, for the most part, is a conv[e]nience wrapper for many other things PHP has as part of its core or in the cURL extension.
As such, this could explain why a lot of the HTTP documentation is missing. It can be found elsewhere within the PHP manual.I have already downloaded and installed Xcode to make my PECL installation easy. I read someone where that this is an important prerequisite for PECL installations in a MAMP environment. Can anyone recommend a sure fire method of installation? Reading about all of the installation failures on the net is a little intimidating.Roddy
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...