title: PHP Cannot open/read CSV file from URL whereas I can open/read it from localhost. What's wrong?
body: <p>Using php I am trying to get some data from a .csv file which is stored online (www.website.com/data/my_file.csv). While testing the code on localhost (using xampp) everything works great, but when I moved my files to my online server it doesn't work.
  What i am doing is: </p>
  
  <pre><code>$filesize=2000;
  $handle = fopen("www.website.com/data/my_file.csv", "r") or die ('cannot open the file');
  $raw = fread($handle, $filesize);
  fclose($handle);
  </code></pre>
  
  <p>this will give me '<em>cannot open the file</em>'. If I try the same code from localhost, it works.
  Furthermore, I tried this other way: </p>
  
  <pre><code>$filesize=2000;
  $handle = fopen("my_file.csv", "r") or die ('cannot open the file');
  $raw = fread($handle, $filesize);
  fclose($handle);
  </code></pre>
  
  <p>which actually works, but the problem is that the .csv file should be open/read from the full url.
  Is there anything that I am overlooking or this is just the wrong way of doing it?</p>