PHP code example of zero-to-prod / curl-helper

1. Go to this page and download the library: Download zero-to-prod/curl-helper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zero-to-prod / curl-helper example snippets


use Zerotoprod\CurlHelper\CurlHelper;

$CurlHandle = curl_init('https://google.com');
curl_setopt_array($CurlHandle, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HEADER => true,
]);
$response = curl_exec($CurlHandle);
$header_size = curl_getinfo($CurlHandle, CURLINFO_HEADER_SIZE);
curl_close($CurlHandle);

$headers = CurlHelper::parseHeaders($response, $header_size);