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

  • Home
  • SEARCH
  • 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 7069021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:23:43+00:00 2026-05-28T05:23:43+00:00

$curl = curl_init(); curl_setopt($curl, CURLOPT_URL, ‘hello_world’); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_CAINFO, getcwd().’/ca.pem’); curl_setopt($curl, CURLOPT_SSLCERT,

  • 0
  $curl = curl_init();

  curl_setopt($curl, CURLOPT_URL, 'hello_world');
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

  curl_setopt($curl, CURLOPT_CAINFO, getcwd().'/ca.pem');
  curl_setopt($curl, CURLOPT_SSLCERT, getcwd().'/client.pem');
  curl_setopt($curl, CURLOPT_SSLKEY, getcwd().'/key.pem');

  $post = array(
    // ...
  );

  curl_setopt($curl, CURLOPT_POST, 1);
  curl_setopt($curl, CURLOPT_POSTFIELDS, join('&', $post));

  $curl_result = curl_exec($curl);
  $error = curl_error($curl);

  var_dump($curl_result);
  var_dump($error);

  curl_close($curl);

this script work in console “php simple.php”
but this script not working in browser

boolean false

string ‘NSS: private key not found for certificate: PEM Token #1:client.pem’ (length=67)

please help

`
    cd /path/to/simple.php; ls -la
    -rwxrwxrwx 1 ujin apache 1.4K Jan 19 19:03 simple.php
    -rw-r--r-- 1 ujin apache 2.6K Jan 19 15:58 ca.pem
    -rw-r--r-- 1 ujin apache 1.6K Jan 19 15:59 client.pem
    -rw-r--r-- 1 ujin apache 1.1K Jan 19 16:18 key.pem
`
  • 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-28T05:23:43+00:00Added an answer on May 28, 2026 at 5:23 am

    Your script can’t find the ca.pem and friends. Some things to try

    • Put in the absolute paths
    • make sure, access rights are OK for the webserver process

    https://www.php.net/manual/en/function.curl-setopt.php tells us, that CURLOPT_CAINFO needs an absolute path!

    EDIT (after discussion with @UJin):

    please try the absolute paths:

      $curl = curl_init();
      curl_setopt($curl, CURLOPT_URL, 'hello_world');
      curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    
      $cwd=getcwd();
    
      //DEBUG
      echo "cwd=$cwd\n";
    
      curl_setopt($curl, CURLOPT_CAINFO, "$cwd/ca.pem");
      curl_setopt($curl, CURLOPT_SSLCERT, "$cwd/client.pem");
      curl_setopt($curl, CURLOPT_SSLKEY, "$cwd/key.pem");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Setting up curl like this: $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$this->domain); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,3); curl_setopt($ch,CURLOPT_FAILONERROR,TRUE); curl_setopt($ch,CURLOPT_USERAGENT,Useragent); curl_setopt($ch,CURLOPT_FOLLOWLOCATION,TRUE);
I have the following PHP code that uses cURL: $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,http://area51.stackexchange.com/users/flair/31.json); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
function get_data($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $data =
This is the function: function NewsDat($url=http://www.url.com/dat/news.dat, $max=5){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch,
When I call the following: file_get_contents('http://whgfdw.ca'); or $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://whgfdw.ca'); curl_setopt($ch,
$ch = curl_init(url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, test); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_HEADER,
$ch = curl_init(http://api.twitter.com/1/statuses/user_timeline/nafhameducation.json); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $latest_tweet = curl_exec($ch); $latest_tweet_id = $latest_tweet[0]->id_str; curl_close($ch); I'm
Here is what I am currently trying: if (function_exists('curl_init')) { $ch = curl_init(); curl_setopt($ch,
This works great to get the header $imageurl = http://p.twimg.com/AW2-vIUCAAE_1FN.png; $ch = curl_init(); curl_setopt
Answer : Implemented using Curl... $file = http://abc.com/data//output.txt; $ch = curl_init($file); $fp = @fopen(out.txt,

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.