Thursday 30 March 2017

PHP and cURL: How WordPress makes HTTP requests


cURL is the workhorse of the modern internet. As its tagline says, cURL is a utility piece of software used to ‘transfer data with urls‘. According to the cURL website, the library is used by billions of people daily in everything from cars and television sets, to mobile phones. It’s the networking backbone of thousands of applications and services. Unsurprisingly, it’s also a core utility used by WordPress’ own Requests API as well as our own WP Migrate DB Pro. If you’re curious about the power of the cURL library, how it works with WordPress and what to watch out for (especially on macOS), then you’re in the right place.
What is cURL?
Let’s start by going over what cURL is. cURL is really two pieces, libcurl which is the C library that does all the magic, and the cURL CLI program. Programming languages like PHP include the libcurl library as a module, allowing them to provide the cURL functionality natively.
The libcurl library is an open source URL transfer library and supports a wide variety of protocols. Not just HTTP, but HTTPS, SCP, SFTP, HTTP/2 and even Gopher. Pretty much every protocol you can imagine – cURL supports. cURL
Source: https://managewp.org/articles/14734/php-and-curl-how-wordpress-makes-http-requests




source https://williechiu40.wordpress.com/2017/03/30/php-and-curl-how-wordpress-makes-http-requests/

No comments:

Post a Comment