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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:42:11+00:00 2026-06-13T01:42:11+00:00

I am trying duplicate the functionality of this command: exec(‘curl -k -d pameters=here https://apiurlhere.com’,

  • 0

I am trying duplicate the functionality of this command:

exec('curl -k -d "pameters=here" https://apiurlhere.com', $output);

with curl_exec():

$url =  'https://apiurlhere.com?parameters=here';
$ci = curl_init();
curl_setopt($ci, CURLOPT_POST, TRUE);
curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ci, CURLOPT_URL, $url);
$response = curl_exec($ci);
curl_close ($ci);
print_r($response);

I have been trying the different options found in the docs (http://php.net/manual/en/function.curl-setopt.php), and thought it was CURLOPT_SSL_VERIFYPEER, but it still failed (response comes back empty).

The URL i’m posting to uses SNI which is causing cURL to fail when the SSL cert returns a different host name than it’s expecting.

Is there a curl_setopt equivalent to -k?

  • 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-06-13T01:42:12+00:00Added an answer on June 13, 2026 at 1:42 am

    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE) is the equivalent of -k on the command line (which you shouldn’t really use, since it makes the connection vulnerable to MITM attacks).

    Your problem here is that you’re assuming that -d "pameters=here" is equivalent to putting these parameters in the URL query like this https://apiurlhere.com?parameters=here.

    This isn’t the case, see documentation for -d:

    (HTTP) Sends the specified data in a POST request to the HTTP server, in the same way that a browser does when a user has
    filled in an HTML form and presses the submit button. This will cause
    curl to pass the data to
    the server using the content-type application/x-www-form-urlencoded.

    You should probably use POSTFIELDS for this:

    curl_setopt($ch, CURLOPT_POSTFIELDS, array("parameters" => "here"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to duplicate this, http://jqueryui.com/demos/autocomplete/#remote-jsonp . Only, instead of querying the geonames.org server
I am trying to duplicate this functionality: http://datatables.net/release-datatables/examples/api/row_details.html The example provides this function: /*
I started this example project to learn meteor: https://github.com/andrewarrow/question-raven/ I'm trying to duplicated a
Possible Duplicate: Comparing functionality between KeyListeners and Key Bindings I've been trying to use
So I'm working with authlogic, and I'm trying to duplicate the login functionality to
I'm using jquery 1.3 and is trying to duplicate the 1.4 .has functionality. I
I am trying to duplicate the functionality that is currently implemented in VB. What
Apologize if this is duplicate - not sure how to word what Im trying
I'm trying to duplicate the Overflow Menu dropdown functionality for other ActionBar items. I'm
I'm trying to duplicate Pinterest's Invite Friends functionality. In case you haven't seen what

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.