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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:46:28+00:00 2026-05-31T10:46:28+00:00

I need to send a GET request to my page pic.php, and I want

  • 0

I need to send a GET request to my page pic.php, and I want to get a real picture in return.

For now I implemented this idea like this:

<?php
if ((isset($_GET['pic']))&&(isset($_GET['key']))){
$pic = $_GET['pic'];
$pic=stripslashes($pic);

header('Location: /content/'.$pic);

}
?>

But it’s not really what I want – it redirects to image directly. What I want is to keep the same URL, but get a needed file depending on what values were submitted.
What is the best way to do that?
thx.

  • 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-31T10:46:29+00:00Added an answer on May 31, 2026 at 10:46 am

    This example code snippet should do what you ask. I’ve also included code to only strip slashes if magic quotes is enabled on the server. This will make your code more portable, and compatible with future versions of PHP. I also added use of getimagesize() to detect the MIME type so that you output the proper headers for the image, and do not have to assume it is of a specific type.

    <?php
    if(isset($_GET['pic']))
    {
        //Only strip slashes if magic quotes is enabled.
        $pic = (get_magic_quotes_gpc()) ? stripslashes($_GET['pic']) : $_GET['pic'];
    
        //Change this to the correct path for your file on the server.
        $pic = '/your/path/to/real/image/location/'.$pic;
    
        //This will get info about the image, including the mime type.
        //The function is called getimagesize(), which is misleading 
        //because it does much more than that.
        $size = getimagesize($pic);
    
        //Now that you know the mime type, include it in the header.
        header('Content-type: '.$size['mime']);
    
        //Read the image and send it directly to the output.
        readfile($pic);
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to send an ordinary get request which replaces the entire page just
I need to send GET Request method with the below headers . I am
I need to get connect with https url, send my request schema and I
I need to send PUT and DELETE along with POST, GET to a REST
Like below,I need to send name and psw value to server side, and get
I have this code for reading webpage. I need to send http header to
i need to make a page that will have a request dialog for a
I'm trying to send json string in the get request to the server, here
I want to send a request to the google places (not google place API),
I need from one JSP open another JSP, and send POST parameters to this

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.