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

  • Home
  • SEARCH
  • 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 3343930
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:00:41+00:00 2026-05-18T01:00:41+00:00

i have to download a file created from a php script. i tried this:

  • 0

i have to download a file created from a php script.
i tried this:

fopen('www.example.com/download.php?key=value', 'rb');

but i stille get a “failed to open stream” error.
how can i do that? If I browse to the url i get the file without problems…

EDIT: sorry, i forgot a piece of the string 🙂

  • 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-05-18T01:00:41+00:00Added an answer on May 18, 2026 at 1:00 am

    I see multiple issues with you request:

    1. You need to specify the open mode. In your case only 'r' applies because you only want to read.
    2. You need to specify the protocol. In your case “http”.
    3. You need to have URL wrappers enabled. Do a phpinfo() and look if allow_url_fopen is set to On.
    4. You probably wanted file_get_contents anyway.
    5. You should enable error reporting and read the error messages. That will help you track the problem faster.
    6. Don’t forget to fclose if you decide to use fopen.

    Example:

    $data = file_get_contents('http://www.example.com/download.php?key=value');
    

    You should also read about fopen in the Manual.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a site, from which you can download an HTML file. This HTML
I have a PHP script that creates an xml file from the db. I
I have a microcontroller that must download a large file from a PC serial
I have a small utility that I use to download an MP3 file from
I have created a PHP-script to update a web server that is live inside
from a PHP script I'm downloading a RSS feed like: $fp = fopen('http://news.google.es/news?cf=all&ned=es_ve&hl=es&output=rss','r') or
I have just coded up a web based flv file download utility. When I
I have to login into a https web page and download a file using
We have a static method in a utility class that will download a file
There is a data file and some image files that I have to download

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.