curl -X GET \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \
-H 'Host: www.instagram.com' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Safari/605.1.15' \
-H 'Accept-Language: ru' \
'https://www.instagram.com/durov/?__a=1'
--proxy-server=localhost:8080в секции chrome.switches.
$options = (new ChromeOptions)->addArguments(collect([
'--window-size=1920,1080',
])->unless($this->hasHeadlessDisabled(), function ($items) {
return $items->merge([
'--disable-gpu',
'--headless',
]);
})->all());
return RemoteWebDriver::create(
$_ENV['DUSK_DRIVER_URL'] ?? 'http://localhost:9515',
DesiredCapabilities::chrome()->setCapability(
ChromeOptions::CAPABILITY, $options
)
);
docker pull php:5.5.27-fpm ...
docker pull php:5.6-fpm ...
docker pull php:7.0-fpm ...
docker pull php:7.1-fpm ...
docker pull php:7.2-fpm ...
...
function xrange(int $min, int $max): iterable {
for ($i = $min; $i < $max; $i++) {
yield $i;
}
}
$startMemory = memory_get_usage();
$array = xrange(1, 34000000);
foreach ($array as $item) {}
print_r($endMemory = memory_get_usage() - $startMemory); // 568
print_r(round($endMemory / 1024 / 1024) . ' MB'); // 0 MB
A preflight request is automatically issued by a browser and in normal cases, front-end developers don't need to craft such requests themselves. It appears when request is qualified as "to be preflighted" and omitted for simple requests.
preg_match_all('#<p[^>]*>(\X*?)</p>#', $html, $matches);