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 129957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:52:19+00:00 2026-05-11T05:52:19+00:00

I can download remote files using PHP but how do you download from a

  • 0

I can download remote files using PHP but how do you download from a link that pushes headers out? I mean, you can click on some links and it will force a download and present you with dialog box to save the file. How can I download and save this sort of thing using PHP?

Any examples or links to tutorials would be great since I couldn’t find anything useful on this topic.

Thank you for any help

Updated and [SOLVED]

<?php  set_time_limit(300);  // File to download $remoteFile = $_GET['url'];  $file = fopen($remoteFile, 'r');   if (!$file) {     echo '<p>Unable to open remote file.\n';     exit; } $line = '';  while (!feof ($file)) {     $line .= fgets ($file, 4096); }  //readfile($line); file_put_contents('here2.mp4',  $line);  fclose($file);  ?> 
  • 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. 2026-05-11T05:52:20+00:00Added an answer on May 11, 2026 at 5:52 am

    Just tried to reproduce situation. Gubmo is right, this download method works for me with Content-Type: application/octet-stream and Content-type: application/force-download headers.

    As explained here, HTTP 410 means that URL requested by the client is no longer available from that system. This is not a ‘never heard of it’ response, but a ‘does not live here any more’ response. Maybe they have some kind of antileach system.

    This should be investigated. If they need cookies — stream-context-create can help. Or maybe they check referer. But I am almost sure that problem is not in headers.

    Hope this helps.

    UPD Sample code you’ve asked about.

    // file to download -- application/octet-stream $remoteFile = 'http://dev/test/remote/send.php'; // file to download -- application/force-download $remoteFile = 'http://chtyvo.org.ua/authors/Skriabin_Kuzma/Ya_Pobieda_i_Berlin.rtf.zip'; // file to store $localFile = 'kuzma.zip';  $fin = fopen($remoteFile, "r"); if (!$fin) {     die("Unable to open remote file"); }  $fout = fopen($localFile, "w"); if (!$fout) {     die("Unable to open local file"); }  while (!feof($fin)) {     $line = fgets($fin, 1024);     fwrite($fout, $line, 1024); }  fclose($fout); fclose($fin); 

    Same as yours.

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

Sidebar

Related Questions

We have some files on our website that users of our software can download.
From where can I download MAPI33.dll. I got the link http://www.mapi33.adexsolutions.com/ from a site
From where I can download Turbo C++ setup, the one with blue srceen which
I have a site, from which you can download an HTML file. This HTML
Does any one know from where can I download source code for Cassini. I
I've done numerous searches and I realize that I can just download this file
Where I can download sample database which can be used for data warehouse creation?
Where can I download the rails migration file for country, state and city table
Can I host an XBAP in my WPF application dynamically? Can I download an
Can I safely download and install .Net framework 3.5 SP1 without requiring my customers

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.