1. Go to this page and download the library: Download ropendev/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/ */
ropendev / curl example snippets
use \rOpenDev\curl\CurlRequest;
$request = new CurlRequest('http://www.example.org/');
$request->setDefaultGetOptions()->setReturnHeader()->setDestkopUserAgent()->setEncodingGzip();
$output = $curl->execute();
echo $output;
use \rOpenDev\curl\CurlRequest;
$request = new CurlRequest('http://www.bing.com/');
$request->setDefaultGetOptions()->setReturnHeader()->setDestkopUserAgent()->setEncodingGzip()->execute();
$r2 = new CurlRequest('http://www.bing.com/search?q=curl+request+php');
echo $r2->setDefaultGetOptions()->setReturnHeader()->setDestkopUserAgent()->setEncodingGzip()->setCookie($request->getCookie())->setProxy('domain:port:user:password')->execute();
use rOpenDev\curl\CurlRequest;
$r = new CurlRequest('scheme://host/path');
$r
->setOpt(CURLOPT_*, mixed 'value')
// Preselect Options to avoid eternity wait
->setDefaultGetOptions($connectTimeOut = 5, $timeOut = 10, $dnsCacheTimeOut = 600, $followLocation = true, $maxRedirs = 5)
->setDefaultSpeedOptions()
->setReturnHeader() // If you want to get the header with getHeader()
->setCookie(string $cookie)
->setReferer(string $url)
->setUserAgent(string $ua)
->setDestkopUserAgent()
->setMobileUserAgent()
->setLessJsUserAgent()
->setPost(array $post)
->setEncodingGzip()
->setProxy(string '[scheme]proxy-host:port[:username:passwrd]') // Scheme, username and passwrd are facultatives. Default Scheme is http://
->setReturnHeaderOnly()
->setUrl($url, $resetPreviousOptions)
string $r->execute(); // Return contents from the url
array $r->getHeader($arrayFormatted = true); // Return Response Header in an array (or in a string if $arrayFormatted is set to false)
string $r->getCookies();
string $r->getEffectiveUrl();
$r->hasError|getError|getInfo(); // Equivalent to curl function curl_errno|curl_error|curl_getinfo();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.