Jump to content

PHP error

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
dirkfirst

dirkfirst

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 354 posts
I'm getting a strange error in PHP while trying to use CURL:


Error2 [60]: error setting certificate verify locations: CAfile: /usr/local/share/curl/curl-ca-bundle.crt CApath: none


What causes this error? I'm connecting to paypal and trying to create a gateway.

#2
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
The problem is you are connecting to a secure site, you need to add some SSL constants to your curl code

#3
dirkfirst

dirkfirst

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 354 posts
hmm, how do I add SSL to CURL?

#4
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
<?php

   $ch = curl_init();

   curl_setopt($ch, CURLOPT_URL, "https://www.paypal.com");

   curl_setopt($ch, CURLOPT_VERBOSE, 1);

   curl_setopt($ch, CURLOPT_USERAGENT,  "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");

   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);

   curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

   $returned = curl_exec($ch);

   curl_close($ch);

   echo $returned;

?>

untested...

#5
Chan

Chan

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 204 posts
I tweaked this a little bit and it worked. Thank you for your help.