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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:23:17+00:00 2026-05-23T22:23:17+00:00

UPDATED THANKS TO ANSWERS: Can someone point out the difference between: $ch = curl_init();

  • 0

UPDATED THANKS TO ANSWERS:

Can someone point out the difference between:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_root);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "xml"); // tried http_build_query also
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Added this, still no good
return curl_exec($ch);  // returns false

and:

$curl = "curl -X POST -d 'xml' {$api_root}";
return `$curl`;  // returns expected xml from server

AND/OR

More generally, are there any good breakdowns out there for conversion/reference between php’s libcurl default values/headers and those of curl on the command line?

I know this is almost a dupe of curl CLI to curl PHP and CLI CURL -> PHP CURL but I’m hoping for something more definitive.

  • 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-23T22:23:17+00:00Added an answer on May 23, 2026 at 10:23 pm

    curl_exec returns true or false by default. You need to specify CURLOPT_RETURNTRANSFER:

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    

    Since curl_exec is returning false (not NULL as indicated in the original question), try using curl_error() to determine why it’s returning false.

    TFM (read it): curl_exec(), curl_setopt()

    Edit for posterity’s sake:

    The OP discovered that an SSL issue was the hindrance. The both libcurl (as called through PHP) and the curl command-line do SSL peer verification for every transaction, unless the user explicitly disables it.

    The likely scenario is that the shell environment is using a different CA bundle than PHP’s libcurl implementation. To remedy this, set CURLOPT_CAINFO to be the same as the shell’s CURL_CA_BUNDLE environment variable and then peer verification should work.

    @OP: I’d be curious to know if the above suggestion is confirmed working in your case, or if there is something else different with the SSL configuration.

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

Sidebar

Related Questions

Original question: Can someone tell me how to use slice lists and the ellipsis?
I've been trying to work out this particular problem and though I can easily
Possible Duplicates: What is the difference between a function expression vs declaration in JavaScript?
This looks like it should be a relatively simple query but can someone please
I've already seen some answers in StackOverflow about how to calculate difference in time
Can someone explain to me the syntax of the For loop in Firebird? Here
UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
UPDATE: Thanks to everyone for the responses. I didn't realize document.write() was deprecated. Add
Update: Thanks for the suggestions guys. After further research, I’ve reformulated the question here:
Update Thanks to Marc's help the AlphaPagedList class is now available on CodePlex if

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.