title: Retrieve data from url and save in php
body: <p>I am trying to retrieve the html from file get contents in php then save it to a php file so I can include it into my homepage.</p>
  
  <p>Unfortunately my script isn't saving the data into the file. I also need to verwrite this data on a daily basis as it will be setup with a cron job.</p>
  
  <p>Can anyone tell me where I am going wrong please? I am just learning php :-)</p>
  
  <pre><code>&lt;?php 
  $richSnippets = file_get_contents('http://website.com/data');
  $filename = 'reviews.txt';
  $handle = fopen($filename,"x+");
  $somecontent = echo $richSnippets;
  fwrite($handle,$somecontent);
  echo "Success";
  fclose($handle);
  ?&gt; 
  </code></pre>