【发布时间】:2018-01-23 20:16:21
【问题描述】:
到目前为止,这是我的代码:
<?php
$start = date("d/m/y", strtotime('today'));
$end = date("d/m/y", strtotime('tomorrow'));
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:51.0) Gecko/20100101 Firefox/51.0"
));
$context = stream_context_create($opts);
$url = "http://www.hot.net.il/PageHandlers/LineUpAdvanceSearch.aspx?text=&channel=506&genre=-1&ageRating=-1&publishYear=-1&productionCountry=-1&startDate=$start&endDate=$end&pageSize=1";
$data = file_get_contents($url, false, $context);
$re = '/LineUpId=(.+\d)/';
preg_match($re, $data, $matches);
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:51.0) Gecko/20100101 Firefox/51.0"
));
$context = stream_context_create($opts);
$url = "http://www.hot.net.il/PageHandlers//LineUpDetails.aspx?lcid=1037&luid=$matches[1]";
$data = file_get_contents($url, false, $context);
echo $data;
?>
我正在尝试为单频道和当前节目准备电视指南,
部分 HTML 页面:
<div class="GuideLineUpDetailsCenter">
<a class="LineUpbold">Name of the Show</a>
<br>
<div class="LineUpDetailsTime">2018 22:45 - 23:30</div>
<br>
<div class="show">Information about the program</div>
<br>
<div class="LineUpbold">+14</div>
<br>
</div>
我想提取内容并执行以下操作:
回显 $LineUpbold;
回显 $LineUpDetailsTime;
回声 $show;
回显 $LineUpbold;
【问题讨论】: