1. Go to this page and download the library: Download palmtree/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/ */
palmtree / curl example snippets
use Palmtree\Curl\Curl;
$contents = Curl::getContents('https://example.org');
use Palmtree\Curl\Curl;
$curl = new Curl('https://example.org');
// Returns the response body when used as a string
echo $curl;
$response = $curl->getResponse();
$headers = $response->getHeaders();
$contentType = $response->getHeader('Content-Type');
$body = $response->getBody();
use Palmtree\Curl\Curl;
$curl = new Curl('https://example.org', [
CURLOPT_FOLLOWLOCATION => true,
]);
$curl->getRequest()->addHeader('Host', 'example.org');
try {
$response = $curl->execute();
} catch(CurlErrorException $e) {
}
$headers = $response->getHeaders();
$body = $response->getBody();
if($response->is404()) {
// handle 404 error
}
if($response->isOk()) {
// response status code is in the 2xx range
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.