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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:33:57+00:00 2026-05-24T20:33:57+00:00

I want to read a server’s reply for a certain request, modify it to

  • 0

I want to read a server’s reply for a certain request, modify it to my needs, and send it to the site visitor. get_headers() works perfectly for the headers, but if the requested file is missing (404), and that’s exactly what I want to use, get_file_contents(), readfile() and other functions I’ve tried all break with the warning/error that the file is missing instead of reading the replied stream into a variable.

So what I want is a function similar to get_headers() only for the rest of the data, like a get_data() that doesn’t cancel. Is there such a thing?

Thanks for reading.

  • 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-24T20:33:58+00:00Added an answer on May 24, 2026 at 8:33 pm

    Use curl_exec. It will always return the body unless the CURLOPT_FAILONERROR option is set to TRUE.

    Here’s an example:

    $url = 'http://www.example.com/thisrequestwillerror';
    
    $curl = curl_init();
    
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HEADER, false);
    
    // This is the default, but just making sure...
    curl_setopt($curl, CURLOPT_FAILONERROR, false);
    
    // Execute and return as a string
    $str = curl_exec($curl);
    
    curl_close($curl);
    
    // Dump the response body
    var_dump($str);
    

    Wrap this in a function and use it wherever you need to get an HTTP response body in your application.

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

Sidebar

Related Questions

I want to read UTF-8 strings from a server that I have control of,
Read about Server push here . I want to push data to client from
What I want to do is make a script on the server read a
I have a asp.net webservice running in windows server 2003, i want it read/write
I want to use MOSS 2007's single sign-on feature, but read that the server
I want to read an appSettings value from the c:\Program Files\Microsoft SQL Server\MSSQL.4\Reporting Services\ReportManager\Web.config
I want to read data from a website with cURL but from a certain
I want to read plain/text from an Https server. I have tried various codes
Hi there I want to read out a file that lies on the server.
Im working in a project.Its server side application is in ofbiz.I want to read,edit,update,etc

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.