V
V
Vlad2016-04-11 13:06:09
PHP
Vlad, 2016-04-11 13:06:09

How to parse a block on a page?

Tell me, please, what should be the regular expression in order to parse from the page everything that is between and I, alas, still cannot comprehend these regular expressions :(
<div id="programm">
<div id="programm_up">

$link = "http://www.teleguide.info/kanal100055_20160413.html";
$page = file_get_contents($link);
preg_match(, $page, $matches);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
OVK2015, 2016-04-11
@Sc0undRel

<?php
  $link = "http://www.teleguide.info/kanal100055_20160413.html";
  $page = file_get_contents($link);
  $regExpWrapper = "#(?:<div id=\"programm\">)(.*?)(?:<div id=\"programm_up\">)#si";
  preg_match_all($regExpWrapper, $page, $matches);
  echo iconv("UTF-8", "CP1251", $matches[1][0]);
?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question