Why there is packet loss when parsing links?

0 like 0 dislike
114 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 | 114 views

1 Answer

0 like 0 dislike
Try using XPath.
Material on the subject: https://youtu.be/id_MNxmdRvk
answered by

Related questions

0 like 0 dislike
2 answers
asked Oct 19, 2018 by AleksandrB
0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
24,509 questions
45,931 answers
0 comments
308 users