как получить HTML-контент из curl_multi_init?

это мой код.

$ch1 = curl_init();
$ch2 = curl_init();
$ch3 = curl_init();
$ch4 = curl_init();
$ch5 = curl_init();
$ch6 = curl_init();
$ch7 = curl_init();
$ch8 = curl_init();
$ch9 = curl_init();
$ch10 = curl_init();

curl_setopt($ch1, CURLOPT_URL, "https://johncena.somewhere/?date="$one);
curl_setopt($ch1, CURLOPT_HEADER, 0);
curl_setopt($ch2, CURLOPT_URL, "https://johncena.somewhere/?date="$one+1);
curl_setopt($ch2, CURLOPT_HEADER, 0);
curl_setopt($ch3, CURLOPT_URL, "https://johncena.somewhere/?date="$one+2);
curl_setopt($ch3, CURLOPT_HEADER, 0);
curl_setopt($ch4, CURLOPT_URL, "https://johncena.somewhere/?date="$one+3);
curl_setopt($ch4, CURLOPT_HEADER, 0);
curl_setopt($ch5, CURLOPT_URL, "https://johncena.somewhere/?date="$one+4);
curl_setopt($ch5, CURLOPT_HEADER, 0);
curl_setopt($ch6, CURLOPT_URL, "https://johncena.somewhere/?date="$one+5);
curl_setopt($ch6, CURLOPT_HEADER, 0);
curl_setopt($ch7, CURLOPT_URL, "https://johncena.somewhere/?date="$one+6);
curl_setopt($ch7, CURLOPT_HEADER, 0);
curl_setopt($ch8, CURLOPT_URL, "https://johncena.somewhere/?date="$one+7);
curl_setopt($ch8, CURLOPT_HEADER, 0);
curl_setopt($ch9, CURLOPT_URL, "https://johncena.somewhere/?date="$one+8);
curl_setopt($ch9, CURLOPT_HEADER, 0);
curl_setopt($ch10, CURLOPT_URL, "https://johncena.somewhere/?date="$one+9);
curl_setopt($ch10, CURLOPT_HEADER, 0);

$mh = curl_multi_init();

curl_multi_add_handle($mh,$ch1);
curl_multi_add_handle($mh,$ch2);
curl_multi_add_handle($mh,$ch3);
curl_multi_add_handle($mh,$ch4);
curl_multi_add_handle($mh,$ch5);
curl_multi_add_handle($mh,$ch6);
curl_multi_add_handle($mh,$ch7);
curl_multi_add_handle($mh,$ch8);
curl_multi_add_handle($mh,$ch9);
curl_multi_add_handle($mh,$ch10);

do {
    $status = curl_multi_exec($mh, $active);
    if($active){
         // do something bra bra bra
    }
} while ($active && $status == CURLM_OK);

curl_multi_remove_handle($mh, $ch1);
curl_multi_remove_handle($mh, $ch2);
curl_multi_remove_handle($mh, $ch3);
curl_multi_remove_handle($mh, $ch4);
curl_multi_remove_handle($mh, $ch5);
curl_multi_remove_handle($mh, $ch6);
curl_multi_remove_handle($mh, $ch7);
curl_multi_remove_handle($mh, $ch8);
curl_multi_remove_handle($mh, $ch9);
curl_multi_remove_handle($mh, $ch10);
curl_multi_close($mh);

Раньше я использовал file_get_contents (), но очень медленно для меня, поэтому я подумал, что буду использовать curl (), но я не знаю, как получить содержимое html в текст, я делаю переменную для хранения curl_multi_exec, но не работаю, эта переменная печатает содержимое html для экран (смеется) Спасибо за помощь и извините за мой английский.

@JitendraYadav Давай попробуем минутку   —  person RBP    schedule 08.10.2020

Не забудьте проголосовать, если это сработает :)   —  person RBP    schedule 08.10.2020

См. также:  Flask-WTForms Как обойти автоматическую предварительную проверку для радиополей
Понравилась статья? Поделиться с друзьями:
IT Шеф
Добавить комментарий

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: