title: PHP scraping & preg_replace
body: <p>I'm scraping weather information of one meteo station and trying to convert it into database format.</p>
  
  <p>I scraped from the web page the data I need, but when I try to replace all the matches in my code it only does it once and also I still don't know how to convert it into an array. the array i'm trying to do is something like (date, time, variable, value). I need the array to put it into a .txt file and a database later.</p>
  
  <p>this is what i've got so far:</p>
  
  <pre><code> &lt;?php;
  
   function scrape_between($data, $start, $end){
      $data = stristr($data, $start); // miro que quito todo antes de start
      $data = substr($data, strlen($start));  // Stripping $start
      $stop = stripos($data, $end);   // Getting the position of the $end of the data to scrape
      $data = substr($data, 0, $stop);    // Stripping all data from after and including the $end of the data to scrape
      return $data;   // devuelvo data entre las sentencias
  
  }
  // Defining the basic cURL function
  $url = 'http://aprs.fi/?c=raw&amp;call=EA4RKU-13&amp;limit=1000&amp;view=normal';
  $ch = curl_init();  // Initialising cURL
  curl_setopt($ch, CURLOPT_URL, $url);    // Setting cURL's URL option with the $url variable passed into the function
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Setting cURL's option to return the webpage data
  $data = curl_exec($ch); // Executing the cURL request and assigning the returned data to the $data variable
  
  $start="&lt;div class='browselist_data'&gt;";
  $end = '&lt;/div&gt;';
  
  $data = scrape_between($data, $start, $end); // me quedo con la parte con span
  
  curl_close($ch);    // Closing cURL
  //echo strip_tags($data); // quita todos los tags html y php deja feo
  
   $z = count($data);
  
   echo "numero de datos: " .$z; //echo $data;   // Returning the data from the function
   $data1=preg_replace('/&lt;b&gt;.+?&lt;\/b&gt;/im', '' ,$data);
   //$data1=preg_replace('/&lt;b&gt;.+?&lt;\/b&gt;/im', '' ,$data);
   $data1=preg_replace('/$&lt;a&gt;.+?&lt;\/a&gt;/', '', $data1);
   echo $data1;
  
   ?&gt;
  </code></pre>