1. Go to this page and download the library: Download wimski/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/ */
wimski / curl example snippets
use Wimski\Curl\CurlResourceFactory;
$curlResourceFactory = new CurlResourceFactory();
$curlResource = $curlResourceFactory->make('https://some-webserver.com/resource-to-request');
$response = $curlResource
->setOption(CURLOPT_RETURNTRANSFER, true)
->execute();
$curlResource->close();
use Wimski\Curl\Contracts\CurlResourceFactoryInterface;
class MyClass
{
public function __construct(
protected CurlResourceFactoryInterface $curlResourceFactory,
) {
}
public function getData(): string
{
$curlResource = $this->curlResourceFactory->make('https://some-webserver.com/resource-to-request');
$response = $curlResource
->setOption(CURLOPT_RETURNTRANSFER, true)
->execute();
$curlResource->close();
return $response;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.