Please enable / Bitte aktiviere JavaScript!
Veuillez activer / Por favor activa el Javascript![ ? ]
Why there is packet loss when parsing links? - bug-code.com Q&A

Why there is packet loss when parsing links?

0 like 0 dislike
168 views
Miniature wrote code for parsing the "certain" values. Actually here it is:
<?php$link  = explode("\", file_get_contents('link.txt'));$proxy = explode("\", file_get_contents('proxy.txt'));$str = [*массив регулярных выражений*];$i = 0; $range = [13, 30];function SetProxy($mas){$config = array('http' => array( 'timeout' => 1.5, 'proxy' => trim($mas[rand(0, count($mas))]), 'request_fulluri' => true, ), ); return stream_context_create($config); } $crContext = SetProxy($proxy); for($set = $range[0]; $set < $range[1]; $set++){ if ($set % 2 == 0){ ReSetProxy:$crContext = SetProxy($proxy); } if($get_page = @file_get_contents(trim($link[$set]), False, $crContext)){ $encoding = iconv("cp1251", "UTF-8", $get_page); for($l=0; $l < count($str); $l++){ preg_match_all('~'.$str[$l].'~si', $encoding, $result); if($result[1][0] != null) if(count($result[1]) < 2) $MoveList[$i][] = preg_replace('~(
]*>| )~is', ' ', $result[1][0]); else{ for($g=0; $g < count($result[1]); $g++) if($result[1][$g] != null) $temp .= ''.$result[1][$g]; $MoveList[$i][] = str_replace(' ', ', ', trim($temp)); } unset($temp); } if(isset($MoveList[$i])){ $i++ }else{ goto ReSetProxy; } }else{ goto ReSetProxy; } } print_r($MoveList); ?>


In the end, the whole thing returns only 12 values, nothing more. Can anyone tell why this happens and whether it is treated?
asked by | 168 views

1 Answer

0 like 0 dislike
Try using XPath.
Material on the subject: https://youtu.be/id_MNxmdRvk
answered by
Welcome to Bug-code Q&A, where you can ask questions and receive answers from other members of the community.

24.8k questions

46.2k answers

0 comments

12.8k users

24,788 questions
46,220 answers
0 comments
12,813 users