PHP HTTP Requests

In these tutorials you can learn how to send HTTP requests in PHP.

  1. Tutorial on how to use proxy servers with cURL and PHP
  2. When using file_get_contents to perform HTTP requests, the server response headers is stored in a reserved variable after each successful request; we can iterate over this when we need to access individual response headers.
  3. Setting custom HTTP Headers with cURL is useful when changing User Agent or Cookies. Headers can be changed two ways, both using the curl_setopt function.
  4. Getting the HTTP response headers with cURL in PHP is not straight forward. There is no build-in way to do this, but we can still cut out the headers from the response message, if CURLOPT_HEADER is true.
  5. How to send HTTP requests using the build-in file functions of PHP.
  6. How to perform HTTP requests trough proxy servers in PHP.
  7. How to use cURL to send HTTP GET and POST requests from PHP applications.
  8. How to send a HTTP HEAD request using cURL in PHP.

HTTP Requests in PHP

These tutorials are dealing with the topic of HTTP requests in PHP, such as the POST request and GET request.

HTTP requests can be performed in many different ways. For example, you could either use PHP's build-in file- functions, or you could use the cURL library for PHP. The difference between the two is often negligible. Another way is to use a library such as Guzzle.

If you are instead looking for how to use cURL from a command line, you should check out this category: cURL CLI Tutorials

Links

  1. Client URL Library - php.net
  2. Guzzle Documentation - docs.guzzlephp.org