const url = 'https://example.com/profile';
const data = { username: 'example' };
try {
const response = await fetch(url, {
method: 'POST', // или 'PUT'
body: JSON.stringify(data), // данные могут быть 'строкой' или {объектом}!
headers: {
'Content-Type': 'application/json'
}
});
const json = await response.json();
console.log('Успех:', JSON.stringify(json));
} catch (error) {
console.error('Ошибка:', error);
}
$a = 122333444455556666667777777;
$b = 5;
echo $a,'<br>';
echo 'Число ', $b, ' встречается в числе ', $a, ', ', substr_count($a, $b), ' раз(а)';
echo $a
печатает 1.2233344445556E+26 это потому что в 32битной сборке php целые числа должны находиться в пределах от -2,147,483,648 до 2 147 483 647 $client = new \Goutte\Client();
$guzzleClient = new \GuzzleHttp\Client(array(
'curl' => array(
CURLOPT_TIMEOUT => 60,
),
));
$client->setClient($guzzleClient);
$crawler = $client->request('GET', 'http://httpbin.org/stream/1024', [
'on_stats' => function (TransferStats $stats) {
echo $stats->getEffectiveUri() . "\n";
echo $stats->getTransferTime() . "\n";
var_dump($stats->getHandlerStats());
// You must check if a response was received before using the
// response object.
if ($stats->hasResponse()) {
echo $stats->getResponse()->getStatusCode();
} else {
// Error data is handler specific. You will need to know what
// type of error data your handler uses before using this
// value.
var_dump($stats->getHandlerErrorData());
}
}
]);
trim($text);
$explodedText = explode(' ', $text);
$resText = str_replace($explodedText[0], '<b>' . $explodedText[0] . '</b>', $text);
echo $resText;
$vibranye = array_filter($shiny, function (array $arr) use ($parametr_widther) {
$processor= new TemplateProcessor($document->getPath());