/ Published in: PHP

Expand |
Embed | Plain Text
<?php require_once('./simple_html_dom.php'); require_once('./GoogleGeocode.php'); //loadUrls(); //getContactLinks(); // getContactInfo(); getAddys(); function loadUrls() { $dom = new simple_html_dom(); $dom->load_file( $urlString ); $divList = $dom->find('div[class=company-info]'); foreach ( $divList as &$div ) { $aList = $div->find('a'); } } } function getContactLinks() { $dom = new simple_html_dom(); $dom->load_file( 'http://www.trainingindustry.com' . $pUrl ); $pList = $dom->find('p[class=btn contact-sponsor]'); $aList = $pList[0]->find('a'); } } } function getContactInfo () { $dom = new simple_html_dom(); $cmd = '/usr/bin/wget -O file.html -t 3 -U "Mozilla/5.0" "http://www.trainingindustry.com' . trim($url1) . '"'; $dom->load_file( './file.html' ); $company_name = ""; $address = ""; $cName = ""; $phone = ""; $company_desc = ""; $website_url = ''; continue; } $divCList = $dom->find('div[class=company-heading]'); $h2List = $divCList[0]->find('h2'); } $descList = $dom->find('div[class=company-desc]'); //echo trim($descList[0]->plaintext); } $aList = $dom->find('a[class=url]'); } $divList = $dom->find('div[class=supplier-v-card]'); foreach ( $divList as &$div ) { $contactDiv = $div->find('div[class=company-address]'); $contact_name_span = $div->find('span[class=fn]'); $phoneLi = $div->find('li[class=tel]'); } } } } function getAddys() { $apiKey = 'ABQIAAAAI1oIsi6Dv7MlmxUm1lRR_xTmarcuMJj81CoryY3grjEx5dFcyxQoeQTublWNe-B1iLVnHNrRuJD6_w'; $geo = new GoogleGeocode( $apiKey ); //$result = $geo->geocode( "124 Merrydale RD San Rafael, CA 94903" ); //print_r( $result ); $addy_array = $geo->geocode( $dirty_addy ); $country = ''; $country = $addy_array['Placemarks'][0]['Country']; } $state = ''; $state = $addy_array['Placemarks'][0]['AdministrativeArea']; } $city = ''; $city = $addy_array['Placemarks'][0]['Locality']; } $street_address = ''; $street_address = $addy_array['Placemarks'][0]['Thoroughfare']; } $zip = ''; $zip = $addy_array['Placemarks'][0]['PostalCode']; } } } ?>
You need to login to post a comment.