What PHP libraries or tools, such as Pear, can be used for handling HTTP requests and cookies?

When handling HTTP requests and cookies in PHP, one popular library that can be used is Guzzle. Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and handle responses. Additionally, for handling cookies, the Symfony HttpClient component can be used, which provides a simple way to work with cookies in PHP.

// Using Guzzle for handling HTTP requests
require 'vendor/autoload.php';

use GuzzleHttp\Client;

$client = new Client();
$response = $client->request('GET', 'https://api.example.com');

echo $response->getBody();

// Using Symfony HttpClient for handling cookies
require 'vendor/autoload.php';

use Symfony\Component\HttpClient\HttpClient;

$client = HttpClient::create();
$response = $client->request('GET', 'https://example.com', [
    'headers' => [
        'Cookie' => 'name=value'
    ]
]);

echo $response->getContent();