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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:02:48+00:00 2026-05-13T11:02:48+00:00

I am using PHP curl method to get a string type response. To create

  • 0

I am using PHP curl method to get a string type response. To create the request I use:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, $data);

$response = curl_exec($ch);
$err = curl_error($ch);

curl_close($ch);

if($response === false)
    throw new Exception(__CLASS__."::".__FUNCTION__."_".$err);
return $response;

Why I always receive a bool(true) response instead of the string I echo from the other side?

Thanks

  • 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-13T11:02:48+00:00Added an answer on May 13, 2026 at 11:02 am

    Since you already have

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    

    in your code. curl_exec should already returns the content of the page instead of a BOOL.

    This is a snippet of a library I use. As pointed out this might not be needed but it helped me out once…

    //The content - if true, will not download the contents
    curl_setopt($ch, CURLOPT_NOBODY, false);
    

    Also it seems to have some bugs related to CURLOPT_NOBODY (which might explain why you have this issue):

    • http://osdir.com/ml/web.curl.general/2005-07/msg00073.html
    • http://curl.haxx.se/mail/curlphp-2008-03/0072.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 490k
  • Answers 490k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Having trouble understanding your question... if you're looking to enlarge… May 16, 2026 at 9:13 am
  • Editorial Team
    Editorial Team added an answer YET ANOTHER EDIT: Seems that my initial evaluation of the… May 16, 2026 at 9:13 am
  • Editorial Team
    Editorial Team added an answer Well, it's a bit "hacky", but you could do this… May 16, 2026 at 9:13 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm using PHP's cURL function to read profiles from steampowered.com. The data retrieved is
I need to send GET Request method with the below headers . I am
I am not well-versed in HTTP requests. How can I, using PHP, grab and
Is there a way in PHP to overwrite a method declared by one interface
I've been struggling for several hours trying to figure out how to get this
I'd like to load a JSON feed from an external source using Javascript; what's
I have the following code that works on PHP5 to send a HTTP POST
I would like to know the best way to save an image from a
The current content of this google docs page is: alt text http://www.deviantsart.com/upload/i9k01q.png However, when

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.