<?php header('Content-Type: text/html; charset=utf-8'); include_once 'simple_dom_parser/simple_html_dom.php'; require_once 'Unirest.php'; $name = "AC/DC Tickets"; $date = "3/17/2016"; $site = "ticketsnow"; $page_data = google_search($name, $date, $site); $page_info = google_html_data($page_data); page_event_info($page_info); function google_search($event_name, $event_date, $ticket_site) { $url = "https://www.google.com/search?q=" . $event_name . " " . $event_date . " " . $ticket_site; $google_page_data = Unirest::GET($url); return $google_page_data->raw_body; } function google_html_data($page_data) { $html = str_get_html($page_data); $link_url; foreach ($html->find('div[class=g] h3[class=r] a') as $element) { $link_check = $element->plaintext; if (strpos($link_check, '- TicketsNow') !== false) { if (strpos($link_check, 'AC/DC Tickets') !== false) { $link_url = $element->href; $link_url = explode("&", $link_url); $link_url = $link_url[0]; $link_url = explode("=", $link_url); $link_url = $link_url[1]; $link_url = str_replace("%3F", "?", $link_url);
<?php header('Content-Type: text/html; charset=utf-8'); include_once 'simple_dom_parser/simple_html_dom.php'; require_once 'Unirest.php'; $name = "adele tickets"; $date = "7/5/2016"; $site = "vividseats"; $requested_url = google_search($name, $date, $site); $page_info = google_html_data($requested_url); event_info($page_info); function google_search($event_name, $event_date, $ticket_site) { $url = "https://www.google.com/search?q=" . $event_name . " " . $event_date . " " . $ticket_site; $google_page_data = Unirest::GET($url); return $google_page_data->raw_body; } function google_html_data($page_data) { $html = str_get_html($page_data); foreach ($html->find('div[class=g] h3[class=r] a') as $element) { $link_check = $element->plaintext; if (strpos($link_check, 'Adele') !== false) { if (strpos($link_check, '7/5/') !== false) { $link_url = $element->href; $link_url = explode("&", $link_url); $link_url = $link_url[0]; $link_url = explode("=", $link_url); $link_url = $link_url[1]; $link_url = str_replace("%3F", "?", $link_url); $link_url = str_replace("%3D", "=", $link_url);