<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "{URL}/v3/documents?version=2018-05-01",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array('file' => '@curriculum.html','source' => 'en','target' => 'fr'),
CURLOPT_HTTPHEADER => array(
"Authorization: Basic YXBpa2V5OnthcGlrZXl9"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
<?php
return [
'support' => [
'class' => 'yii\swiftmailer\Mailer',
'useFileTransport' => false,
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'mailmail.ru',
'username' => 'support@mail.ru',
'password' => 'c',
'port' => '465',
'encryption' => 'ssl',
],
],
'noReply' => [
'class' => 'yii\swiftmailer\Mailer',
'useFileTransport' => false,
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'mail.mail.ru',
'username' => 'noreply@mail.ru',
'password' => '',
'port' => '465',
'encryption' => 'ssl',
],
],
];
$mailers = require __DIR__ . '/../components/mailer/config.php';
'components'=> [
...
'supportMailer' => $mailers['support'],
'noreplyMailer' => $mailers['noReply'],
...
]
Yii::$app=>supportMailer ...
Yii::$app=>noreplyMailer...
$before = 1599627581;
$after = time();
if (($after - $before) >= 300)
{
echo 'Прошло 5 минут';
}
<?php
$before = 1599627581; # время от которого веси отсчет
$after = time(); # текущее время
$diff = 5; # сколько должно пройти минут
if (($after - $before) >= ($diff*60))
{
echo 'Прошло 5 минут';
}
$article->find('img.lazy-loaded')->attr('src');
$article->find('img.lazy-loaded')->getAttribute('src');
$json = '[
{
"id": 963343,
"name": "\u0424\u043e\u0440\u043c\u0430 \u0433\u043e\u043b\u043e\u0441\u0430",
"name_eng": "Koe no katachi",
"year": "2016"
},
{
"id": 977743,
"name": "\u0424\u043e\u0440\u043c\u0430 \u0432\u043e\u0434\u044b",
"name_eng": "The Shape of Water",
"year": "2017"
},
{
"id": 493390,
"name": "\u0413\u043e\u043b\u043e\u0441\u0430",
"name_eng": "The Voices",
"year": "2014"
}
]';
$array = json_decode($json, true);
$result = array_filter($array, function($item){
if ($item['name'] == 'Форма голоса' && $item['year'] == '2016') return $item;
});
var_dump($result);