Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8124423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:27:31+00:00 2026-06-06T06:27:31+00:00

Using php I am trying to get some data from a .csv file which

  • 0

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:

$filesize=2000;
$handle = fopen("www.website.com/data/my_file.csv", "r") or die ('cannot open the file');
$raw = fread($handle, $filesize);
fclose($handle);

this will give me ‘cannot open the file‘. If I try the same code from localhost, it works.
Furthermore, I tried this other way:

$filesize=2000;
$handle = fopen("my_file.csv", "r") or die ('cannot open the file');
$raw = fread($handle, $filesize);
fclose($handle);

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T06:27:32+00:00Added an answer on June 6, 2026 at 6:27 am

    Are you on a shared hosting account of some sort? A lot of those places don’t allow remote calls by disabling the allow_url_fopen directive.

    Try running this at the beginning of your file:

    <?php
       ini_set("allow_url_fopen", 1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get character data from www.wowarmory.com using PHP and cURL. The code
I am trying to download a CSV file from a URL using PHP Curl,
I am trying to get some data back from a server using jQuery $.getJSON
I am trying to get some data from Magento trough php, it works but
I'm trying to create a procedure which extracts data from a MySQL server (using
I am trying to make some data from database available using XML, I have
I'm trying to read data from a.csv file to ouput it on a webpage
I've been going bananas trying to get some data from Javascript on one page
I am trying to get some data from page to page and then mail
i am trying to scrape some data from this site : http://laperuanavegana.wordpress.com/ . actually

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.