Guest User

Untitled

a guest
Feb 21st, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. $xml = simplexml_load_file($baseUrl) or die("The feed did not load!");
  2.  
  3. // Get the XML and store as their respective variables.
  4.  
  5.  
  6. $xml_query = $xml->query; // The data contained in the <query> tag from the xml response
  7. $location = $xml->location; // Location searched.
  8. $totalResults = $xml->totalresults;
  9. $starts = $xml->start; // First result shown on page
  10. $end = 5; // Last result shown on page
  11. $ursl = $xml->results->result->xml;
  12.  
  13. /*
  14. $jobTitles = $xml->results->result->jobtitle;
  15. $companys = $xml->results->result->company;
  16. $citys = $xml->results->result->city;
  17. $states = $xml->results->result->state;
  18. $countrys = $xml->results->result->country;
  19. $dates = $xml->results->result->date;
  20. */
  21.  
  22. for ($start = 1; $start <= $end; $start++) {
  23. $jobTitles = $xml->results->result->jobtitle;
  24. foreach($jobTitles as $jobTitle) {
  25. echo "<p align=\"center\"><b><a href=" . $url . ">" . $jobTitle . "&nbsp - &nbsp ";
  26. }
  27. $companys = $xml->results->result->company;
  28. foreach($companys as $company) {
  29. echo $company . "</a></b><br>";
  30. }
  31. $citys = $xml->results->result->city;
  32. foreach($citys as $city) {
  33. echo $city . ", ";
  34. }
  35. $states = $xml->results->result->state;
  36. foreach($states as $state) {
  37. echo $state . ", ";
  38. }
  39. $countrys = $xml->results->result->country;
  40. foreach($countrys as $country) {
  41. echo $country . " &nbsp &nbsp &nbsp ";
  42. }
  43. $dates = $xml->results->result->date;
  44. foreach($dates as $date) {
  45. echo "<b>|</b> &nbsp &nbsp &nbsp " . $date . "</p>";
  46. }
  47. $descriptions = $xml->results->result->snippet;$urls = $xml->results->result->url;
  48. foreach($descriptions as $description) {
  49. echo "<p>" . $description . "</p>";
  50. }
  51. }
Add Comment
Please, Sign In to add comment