Page 1 of 1
Parsing data?
Posted: Fri Apr 11, 2008 9:34 pm
by davidbeck12
Dear Readers
I want to know how can I parse data from one website ,(for example I want to parse name ,address,phonenumber ),show it on to another website ?In nutshell I want to see data from other sites and put it into my website.
Best Regards
David
Re: Parsing data?
Posted: Fri Apr 11, 2008 9:54 pm
by m4rv5
You could use cURL to access the file if its enabled then pass the content to a variable. Then you could use regex (preg_match/ preg_match_all) on the captured content to extract the data you need.
if cURL is disabled, fopen will also do.
Re: Parsing data?
Posted: Sun Apr 13, 2008 10:57 pm
by davidbeck12
Thankyou fo replying!!
I want to know how to get strated with curl?I dont know php.
Thanks in advance.
Re: Parsing data?
Posted: Sun Apr 13, 2008 11:23 pm
by m4rv5
try this code:
Code: Select all
<?php
$url = 'http://forums.devnetwork.net/viewtopic.php?f=1&t=81316';
$htmlDataToParse = getWebContent($url);
print_r($htmlDataToParse);
function getWebContent($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
?>
You could continue reading more about cURL here:
http://php.net/manual/en/book.curl.php
Hope that helped.
Re: Parsing data?
Posted: Mon Apr 14, 2008 10:40 am
by davidbeck12
Thankyou for replying once again!!
I just found WAMP which works well with PHP and cURL.Any suggestions?
I am not sure thats why wanted to have your expert advice.
Best Regards
David