PHP code example of amirasaran / yii2-curl
1. Go to this page and download the library: Download amirasaran/yii2-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/ */
amirasaran / yii2-curl example snippets
'components' => [
...
'curl' => [
'class' => 'amirasaran\yii2curl\Curl',
'connectionTimeout' => 100,
'dataTimeout' => 100,
],
...
]
$url = 'http://jsonplaceholder.typicode.com/posts';
/** @var \amirasaran\yii2curl\Curl $curl */
$curl = Yii::$app->curl;
$res = $curl->get($url,[],false);
echo '<pre>';
print_r($res);exit;
php composer.phar