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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:55:26+00:00 2026-05-16T03:55:26+00:00

i wonder if you guys come up with some awesome solutions for my problem.

  • 0

i wonder if you guys come up with some awesome solutions for my problem. the normal way is not working!

Well, i’m trying to force-download any file on any website with the following php script. I just pass ?p=http://www.whatever.com/images/flowers/rose.jpg to my url and the download prompts.

    <?php
    error_reporting(E_ALL);

    if(isset($_GET['p'])) $path = $_GET['p'];
    else echo "no path set!";

    $file = $path;
    //header('Location:' . $file); //works perfect, opens the file in the browser
    //
    header("Cache-Control: no-cache");
    header("Expires: -1");
    header("Content-Type: application/octet-stream;");
    header("Content-Disposition: attachment; filename=\"" . basename($file) . "\";");
    header("Content-Transfer-Encoding: binary");
    header("Content-Length: " . filesize($file));
    echo readfile($file);
    ?> 

However, as I found out today filesize() just works with local files on my server not with an http request. The same applies to readfile()

Warning: filesize() [function.filesize]: stat failed for
pathtofiles…/downloader/d.php on line
15

Warning:
readfile(sphotos.ak.fbcdn.net/hphotos-ak-snc4/hs211.snc4/…)
[function.readfile]: failed to open
stream: HTTP request failed! HTTP/1.0
403 Forbidden in
pathtofiles…/downloader/d.php on line
16

i wonder if there are creative coders out there who can help me out here. Is there any chance for me to make that script work? I just want to forcedownload whatever file and url you pass along.

thank you advance,
regards matt

  • 1 1 Answer
  • 4 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-16T03:55:27+00:00Added an answer on May 16, 2026 at 3:55 am

    filesize() and readfile() can work with some protocols if your PHP settings allow.

    The problem at hand is a more fundamental one, though:

    HTTP request failed! HTTP/1.0 403 Forbidden in pathtofiles….

    remember that when fetching a file using PHP, it does not have the user’s login permissions available. The script instaince is acting like an independent browser. If a resource is password protected, you need to make your PHP script log in first.

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

Sidebar

Related Questions

Hi guys wonder if you guys could help me I'm trying to compile a
I wonder, using Eclipse's PyDev plugin , how come documentation does not always show
hey guys, i wonder how I could solve this in the best way: I
hey guys, i'm working on a concept for university. i wonder what's the easiest
wonder if someone could help me with a little problem. I have session values
hey guys, i'm not looking for a mod_rewrite thing or anything related. i'm just
I know I can download Wikipedia entirely. But I wonder if there is any
I wonder if any of you guys knows how to show an ajax loading
The eclipse and checkstyle guys of you will surely now this problem: After organizing
Hi I was wondering if you guys have a problem with Tank Auth. After

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.