function scrapeHF() { $url = "http://www.hocicosfelices.com.ar/buscados"; $html_content = scraperWiki::scrape($url); $html = str_get_html($html_content); $html_div = $html->find("div.entry-content", 0); $pet_htmls = returnSubstrings($html_div, '<h3', '<h3'); if (count($pet_htmls) > 0) { array_shift($pet_htmls); foreach ($pet_htmls as $pet_html_raw) { //print "pet found: ".$pet_html."\n"; $pet_html_raw = "<h3" . $pet_html_raw; $pet_html = str_get_html($pet_html_raw); $title = $pet_html->find("h3", 0)->plaintext; $more_info = $pet_html->find("p", 0)->plaintext; $img_html = $pet_html->find("img", 0)->outertext; $pet_data = array(); $pet_data["Codigo"] = utf8_encode(trim($title)); $pet_data["Titulo"] = trim($title); $pet_data["Mas_info"] = trim($more_info) . "<br>" . $img_html; $address = ""; if (array_key_exists('Calle', $pet_data)) { $address = $pet_data["Calle"] . ", "; } if (array_key_exists('Barrio', $pet_data)) { $address .= $pet_data["Barrio"] . ", "; } $address .= "San Carlos de Bariloche, Río Negro, Argentina"; $pet_data["Direccion"] = $address; $geo_data = geoCode($address); //$geo_data=geoCode($more_info); //$pet_data["Cat"]=$cat_ext; if (array_key_exists('lat', $geo_data)) { $pet_data["Lat"] = $geo_data["lat"]; $pet_data["Lng"] = $geo_data["lng"]; $pet_data["Direccion_geo"] = $geo_data["formatted_address"]; createReport($pet_data); //scraperwiki::save(array('Codigo'), $pet_data); } } } }
createReport Creates a report Error Codes: 1: no statement executed Returns complete */ $app->post('/api/createReport', function () use($dbh) { $args[':bountyID'] = $_POST['bountyID']; $args[':username'] = $_POST['username']; $args[':description'] = $_POST['description']; $args[':link'] = $_POST['link']; $args[':pathToError'] = $_POST['pathToError']; $args[':errorName'] = $_POST['errorName']; $result = createReport($dbh, $args); echo json_encode($result); }); /* Ryan Edson updateReport Updates a report with whether they are getting paid or not Also adds report to PaymentTable (table which will handle paypal, not in db yet) Error Codes: Returns complete */ $app->post('/api/updateReport', function () use($dbh) { $changeCode = $_POST['changeCode']; if ($changeCode == 1) {