-
Notifications
You must be signed in to change notification settings - Fork 0
/
cnn-republika.php
113 lines (99 loc) · 3.36 KB
/
cnn-republika.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<center>
<a href="http://www.cnnindonesia.com/">
<img src="//www.cnnindonesia.com/assets/image/logo_new.png" width="100" height="100">
</a>
</center>
</div>
<div class="panel-body">
<?php
foreach($htmlcnn->find('a') as $linkjudul)
{
if (substr("'".$linkjudul->href."'",1,24)=="http://cnnindonesia.com/")
{
$urlnya=$linkjudul->href;
$pecah=explode('/',$urlnya);
$judul=str_replace("-"," ",$pecah[5]);
$judulketemu=preg_match("/".$qcari."/i", $judul);
if($judulketemu){
$c++;
/*echo "==============================================================================================<br>";*/
/*echo " Berita <b> CNN </b> dengan kata kunci: <b>".$qcari."</b>";*/
echo "<br>";
echo "<center>";
echo "<h4><p class='uppercase'>".$judul."</p></h4>";
echo "</center>";
echo "<a href='".$urlnya."'target='_blank'>".$urlnya."</a><br><br>";
$htmlcnn->load_file($urlnya);
foreach($htmlcnn->find('div') as $linkisi)
{
if ($linkisi->class=="text_detail")
{
$beritanya=str_replace("'","-",(strip_tags($linkisi)));
echo "Isi Berita :<br>".$beritanya."<br>";
/*echo "==============================================================================================<br>";*/
}
}break;
}//if
/*else if($judulketemu == FALSE)
{
echo "tidak ada berita";
}break;*/
}
}
?>
</div>
<div class="panel-footer">
<?php echo "<center> banyak berita CNN: ".$c."</center>"; ?>
</div>
</div>
</div><!--end col-6 -->
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<center>
<a href="http://www.republika.co.id/">
<img src="http://www.republika.co.id/files/images/1republika.co.id_03.png" >
</a>
</center>
</div>
<div class="panel-body">
<?php
foreach($htmlrep->find('a') as $linkjudul)
{
$link=str_replace("/", "", $linkjudul->href);
$linkambil=preg_match("/republika.co.idberita/", $link);
if ($linkambil)
{
$urlnya=$linkjudul->href;
$pecah=explode('/',$urlnya);
$judul=substr(str_replace("-"," ",$pecah[9]),9);
$judulketemu=preg_match("/".$qcari."/i", $judul);
if($judulketemu){
$r++;
echo "<br>";
echo "<center>";
echo "<h4><p class='uppercase'>".$judul."</p></h4>";
echo "</center>";
echo "<a href='".$urlnya."'target='_blank'>".$urlnya."</a><br><br>";
$htmlrep->load_file($urlnya);
foreach($htmlrep->find('div') as $linkisi)
{
if ($linkisi->class=="content-detail")
{
$beritanya=str_replace("'","-",(strip_tags($linkisi)));
echo "Isi Berita :<br>".$beritanya."<br>";
}
}break;
}
}
}
?>
</div>
<div class="panel-footer">
<?php echo "<center> banyak berita Republika: ".$r."</center>"; ?>
</div>
</div>
</div><!--end col-6 -->