Tell me why the regular #<li style="list-style-position:(.*?)>(.*?)<br/># works here , but not in the code?

 $x=file_get_contents('http://forum3.ru/cgi/shop/ishop.pl?cmd=show_tovar&code=90929&xhr=1'); ini_set('pcre.backtrack_limit',10000000); $x=htmlspecialchars($x); preg_match_all('#<li style="list-style-position:(.*?)>(.*?)<br/>#',$x,$matches); echo $matches[2][1]; 

code proper

  • one
    In slashes, regular expressions do not have to be driven?) Plus <br/> obviously will not meet, because $ x is processed through htmlspecialchars (). - ivkremer Sep.
  • I understood what mistake I made) I'll go to redo it) - Only_fallen
  • After removing $x=htmlspecialchars($x); it didn't get better ( - Only_fallen
  • I understand that then all the same it became?) - ivkremer

1 answer 1

 $x=file_get_contents('http://forum3.ru/cgi/shop/ishop.pl?cmd=show_tovar&code=90929&xhr=1'); ini_set('pcre.backtrack_limit',10000000); // $x=htmlspecialchars($x); preg_match_all('#<li style="list-style-position:(.*?)>(.*?)<br/>#',$x,$matches); echo $matches[1]; 

and so?

  • If $matches[2][1] , then it displays what you need ... Xm ... and what has changed except $x=htmlspecialchars($x); can not understand. - Only_fallen
  • Do not know how, but it began to work .... - Only_fallen
  • although I tried to delete this line - Only_fallen
  • Well, that's nice - Victor Coder
  • in general, thank you, bright magician)) - Only_fallen