Yngvarr

Generation

generate functionThu, 13 Apr 2023

curl asynchrone pool

<?php // Create a curl handle to a non-existing location $ch = curl_init('http://www.example.com/doesntexist'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Create a DOM object $dom = new DOMDocument; // Augment the DOM object with the addCallback function $dom->addCallback = function($ch, $data) use ($dom) { @$dom->loadHTML($data); }; // Set your options and execute curl_setopt_array($ch, array( CURLOPT_URL => "http://www.example.com/", CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 2, CURLOPT_COOKIEFILE => "", CURLOPT_COOKIEJAR => "", CURLOPT_USERAGENT => "Mozilla/5.0 (X11; U; Linux x86_64; en-US;

Questions about programming?Chat with your personal AI assistant