0

I Want to load a Specific Div of an external webpage into a specific Div (No iframe) Of my own website. for example: I have a div like this in my own website:

<div id="weather-status"> Weather Status </div>

I have this site too: http://www.timeanddate.com/weather/ and I want to load a table from this site (http://www.timeanddate.com/weather/) into my div (Weather Status) How Can I Do This?

Meghdad Hadidi
  • 1,093
  • 13
  • 28

1 Answers1

1
<?php
   $url = "http://www.timeanddate.com/weather/";
   $page_all = file_get_contents($url); 

   preg_match('#<table class="border2 lpad wa">(.*)</table>#ms', $page_all, $div_array);


   echo "<pre>";
   print_r($div_array[0]);
   echo "</pre>";
?>

With the following CSS :

.wa {
    margin: 0 auto;
}

.border2 {
    background: none repeat scroll 0 0 #D7D6DC;
}

.lpad tr td {
    padding: 0.2em;
}
Ariful Islam
  • 7,639
  • 7
  • 36
  • 54