I'm making a personal website for a car dealer, who puts his deals on a huge country wide car sale website and wants to have same car deals in the companies website. To avoid double submissions i decided to take the car info from the country wide website and to put it into the company website.
Company website is made on Wordpress. I'm not very familiar with PHP.
Is there a plugin for this kind of work? Maybe i could achieve this by using something like node.js?
I imagine the process could look something like this: The script scans the main country wide website if there are new cars, it should open them, read the information inside and put the information to the companies website, so it could be displayed.
have a look at this:
function get_inner_html( $node ) {
$innerHTML= '';
$children = $node->childNodes;
foreach ($children as $child) {
$innerHTML .= $child->ownerDocument->saveXML( $child );
}
return $innerHTML;
}
function get_html_table($link,$element,$class){
//$data=date("Y-m-d");
$html = file_get_contents($link); //get the html returned from the following url
$poke_doc = new DOMDocument();
libxml_use_internal_errors(false); //disable libxml errors
libxml_use_internal_errors(true);
if(!empty($html)){ //if any html is actually returned
$poke_doc->loadHTML($html);
libxml_clear_errors(); //remove errors for yucky html
$poke_xpath = new DOMXPath($poke_doc);
$poke_type = $poke_xpath->query("//".$element."[@class='".$class."']");
$table = "<table>";
foreach($poke_type as $type){
$table .= get_inner_html($type);
}
$table .= "</table>";
return $table;
}
echo get_html_table('https://www.linkname.com','div','kv');
//fist parameter the link; second: the dom element you want to scrap; third the class of the element
in your case get_html_table('http://auto.plius.lt/litechnija/skelbimai/zemes-ukio-misko-technika-manipuliatoriai/zemes-ukio-savaeige-technika','div','item');