PHP code example of skoro / curl

1. Go to this page and download the library: Download skoro/curl 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/ */

    

skoro / curl example snippets


// Include composer autoload script.
 request.
$content = Curl::get('google.com');

// HEAD request
$curl = new Curl('google.com', 'HEAD');
$body = $curl->request(); // Returns response with headers.
         $curl->getResponse(); // Returns "raw" response.
         $curl->getResponseHeaders(); // Returns array of headers.
}



use skoro\curl\Multi;
use skoro\curl\Curl;

$multi = new Multi();
// Attach curl instances and run them.
$multi->add(new Curl('google.com', 'HEAD'))
      ->add(new Curl('microsoft.com', 'HEAD'))
      ->add(new Curl('amazon.com'))
      ->run();
// Get responses.
foreach ($multi as $curl) {
    var_dump($curl->getResponse());
}

php composer.phar