PHP kullanarak HTML Veri Extract

0 Cevap php

İşte aradığım budur:

Ben HTML formatında bazı verileri görüntüleyen bir bağlantı var:

http://www.118.com/people-search.mvc...0&pageNumber=1

Veriler aşağıdaki formatta geliyor:

<div class="searchResult regular"> 

Bird John

56 Leathwaite Road
London
SW11 6RS 020 7228 5576

I want my PHP page to execute above URL and Extract/Parse Data from the Result HTML page based on above Tags as h2=Name address=Address telephoneNumber= Phone Number

ve bir Tabular biçimde görüntüleyebilirsiniz.

Bu var ama o sadece bir HTML sayfası METİN biçimini gösterir, ancak bir ölçüde çalışır:

<?
function get_content($url) 
{ 
$ch = curl_init(); 

curl_setopt ($ch, CURLOPT_URL, $url); 
curl_setopt ($ch, CURLOPT_HEADER, 0); 

ob_start(); 

curl_exec ($ch); 
curl_close ($ch); 
$string = ob_get_contents(); 

ob_end_clean(); 

return $string; 

} 


$content = get_content("http://www.118.com/people-search.mvc?Supplied=true&Name=william&Location=Crabtree&pageSize=50&pageNumber=1"); 
echo $content;
$content = get_content("http://www.118.com/people-search.mvc?Supplied=true&Name=william&Location=Crabtree&pageSize=50&pageNumber=2"); 
echo $content;
$content = get_content("http://www.118.com/people-search.mvc?Supplied=true&Name=william&Location=Crabtree&pageSize=50&pageNumber=3"); 
echo $content;
$content = get_content("http://www.118.com/people-search.mvc?Supplied=true&Name=william&Location=Crabtree&pageSize=50&pageNumber=4"); 
echo $content;

?>

0 Cevap