I am trying to embed square payment method to my site through its documentation given in the link below.
https://docs.connect.squareup.com/articles/processing-payment-php/
After receiving nonce, I am trying to get the location id as defined in the documentation. In console it always returns the following error:
Fatal error: Uncaught exception 'SquareConnect\ApiException' with message 'API call to https://connect.squareup.com/v2/locations failed: SSL certificate problem: unable to get local issuer certificate' in C:\xampp\htdocs\my_project\vendor\square\connect\lib\ApiClient.php:245
Stack trace:
#0 C:\xampp\htdocs\my_project\vendor\square\connect\lib\Api\LocationApi.php(165): SquareConnect\ApiClient->callApi('/v2/locations', 'GET', Array, '', Array, '\\SquareConnect\\...')
#1 C:\xampp\htdocs\my_project\vendor\square\connect\lib\Api\LocationApi.php(105): SquareConnect\Api\LocationApi->listLocationsWithHttpInfo('sq0atb-a8CwQY9D...')
#2 C:\xampp\htdocs\my_project\locations-test.php(10): SquareConnect\Api\LocationApi->listLocations('sq0atb-a8CwQY9D...')
#3 {main}
thrown in C:\xampp\htdocs\my_project\vendor\square\connect\lib\ApiClient.php on line 245
You might not have the most up-to-date CA certificate bundle. Try the steps in this related StackOverflow answer and see if that works: https://stackoverflow.com/a/19149687
If that doesn't work, what operating system version and what version of PHP are you using? In an interactive PHP console (php -a), what is the output of echo OPENSSL_VERSION_TEXT;? Finally, what is the output of openssl s_client -connect connect.squareup.com:443 (in cmd, not the PHP console)?
Related
Having an issue with the XERO API when trying for the first time. This is with a clean LAMP install with SSL certificate in place.
When I go to authorization.php it takes me to Xero to authenticate and then back to callback.php with the following error.
Fatal error: Uncaught GuzzleHttp\Exception\ConnectException: cURL error 7: (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) in /var/www/DOMAIN.CO.UK/public_html/xero/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:200 Stack trace: #0
/var/www/DOMAIN.CO.UK/public_html/xero/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(155): GuzzleHttp\Handler\CurlFactory::createRejection() #1
/var/www/DOMAIN.CO.UK/public_html/xero/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(105): GuzzleHttp\Handler\CurlFactory::finishError() #2
/var/www/DOMAIN.CO.UK/public_html/xero/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish() #3 /var/www/DOMAIN.CO.UK/public_html/xero/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(28): GuzzleHttp\Handler\CurlHandler->__invoke() #4
/var/www/DOMAIN.CO.UK/public_html/xero/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(51): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}() #5
/var/www/train in /var/www/DOMAIN.CO.UK/public_html/xero/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php on line 200
I've no idea what this issue is and ive tried looking online everywhere with no joy.
My set up is:
Centos 8
PHP 7.4.6
Apache2
I installed PHRETS with Composer and have been able to print information using CMD terminal and following the docs. I tried uploading all the files to my web server, but the page times out.
My error log shows the following:
PHP Fatal error: Uncaught exception 'GuzzleHttp\Ring\Exception\ConnectException' with message 'cURL error 7: Failed to connect to rets-rald.realtyserver.com port 6103: Connection timed out' in /public_html/phrets/vendor/guzzlehttp/ringphp/src/Client/CurlFactory.php:126
Stack trace:
#0 /public_html/phrets/vendor/guzzlehttp/ringphp/src/Client/CurlFactory.php(91): GuzzleHttp\Ring\Client\CurlFactory::createErrorResponse(Array, Array, Array)
#1 /public_html/phrets/vendor/guzzlehttp/ringphp/src/Client/CurlHandler.php(96): GuzzleHttp\Ring\Client\CurlFactory::createResponse(Array, Array, Array, Array, Resource id #69)
#2 /public_html/phrets/vendor/guzzlehttp/ringphp/src/Client/CurlHandler.php(68): GuzzleHttp\Ring\Client\CurlHandler->_invokeAsArray(Array)
#3 /public_html/phrets/vendor/guzzlehttp/ringphp/src/Client/Middleware.php(54): GuzzleHttp\Ring\Client\CurlHandler->__invoke(Array)
#4 /public_html/phrets/vendor/guzzlehttp/ringphp/src/Client/Middlewa in /public_html/phrets/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 49
How can I get it working on the web server? Below is my configuration.
$config = new \PHRETS\Configuration;
$config->setLoginUrl('http://rets-rald.realtyserver.com:6103/saskatchewan/rets/login');
$config->setUsername('username');
$config->setPassword('password');
$config->setRetsVersion('1.5');
$config->setUserAgent('PHRETS/2.0');
$config->setHttpAuthenticationMethod('digest');
$config->setOption('use_post_method', false);
$config->setOption('disable_follow_location', false);
Turns out, I just needed to enable port 6103 on the server.
I am doing project in laravel. I am using plivo api for sending sms. For that I followed all the steps mentioned at
https://www.plivo.com/docs/getting-started/send-a-single-sms/ .
but When I tried to run my php file then I am getting error message as
"Fatal error: Uncaught exception 'GuzzleHttp\Exception\RequestException' with message 'cURL error 60: SSL certificate problem: self signed certificate in certificate chain (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)' in G:\Xampp\htdocs\plivoTrial\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:187 Stack trace: #0 G:\Xampp\htdocs\plivoTrial\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(150): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array) #1 G:\Xampp\htdocs\plivoTrial\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(103): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory)) #2 G:\Xampp\htdocs\plivoTrial\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory)) #3 G:\Xampp\htdocs\plivoTria in G:\Xampp\htdocs\plivoTrial\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 187".
My php file looks like,
<?php
require 'vendor/autoload.php';
use Plivo\RestAPI;
$auth_id = "xxxxxxxxxxxxx";
$auth_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$p = new RestAPI($auth_id, $auth_token);
// Set message parameters
$params = array(
'src' => 'xxxxxxxxxxx',
'dst' => '91xxxxxxxxxx',
'text' => 'Hi, I am Amarja :)',
'url' => 'http://localhost/untitled/sentsms.php',
'method' => 'POST'
);
// Send message
$response = $p->send_message($params);
echo "Response : ";
print_r ($response['response']);
echo "<br> Api ID : {$response['response']['api_id']} <br>";
echo "Message UUID : {$response['response']['message_uuid'][0]} <br>";
?>
I am not getting how to solve this problem. please help and many thanks in advance.
Do not disable SSL
Instead, fix your PHP installation.
These directions worked for me on Windows.
This problem shows up when your CA root certificates are missing or out-of-date. Since at the moment ALL the Windows platform PHP installers DO NOT include the CA root certificates in the distribution, its much more common on Windows than on Linux.
Here is how you update the CA root certificates:
Download an up-to-date copy of CA root certificates.
Save the file "cacert.pem" to your computer. For example c:\xampp\php
Add the location of the "cacert.pem" file from Step 2 to your php.ini file.
Search for [curl] in your php.ini file and update or add the following line:
curl.cainfo=c:\xampp\php\cacert.pem
Restart your web server.
Curl now has a valid CA root certificate bundle and can verify the SSL certificates of remote servers.
If you are running any of the Google Cloud Platform PHP examples on a Windows computer you'll get the following cURL error : CURLE_SSL_CACERT (60) - Peer certificate cannot be authenticated with known CA certificates. That error should now be self-explanatory along with how to fix it.
I have download the AWS(Amazon) SDK for PHP and put the credential that are required for amazon web service. Then i run the sample code file name(cli-ec2_sorting_and_filtering.php) that are in the sample folder btu i am getting this following error.
Fatal error: Uncaught exception 'cURL_Exception' with message 'cURL resource: Resource id #13; cURL error: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed (cURL error code 60). See http://curl.haxx.se/libcurl/c/libcurl-errors.html for an explanation of error codes.' in C:\xampp\htdocs\amazon\lib\requestcore\requestcore.class.php:843 Stack trace: #0 C:\xampp\htdocs\amazon\sdk.class.php(1037): RequestCore->send_request() #1 C:\xampp\htdocs\amazon\services\ec2.class.php(2270): CFRuntime->authenticate('DescribeImages', Array) #2 C:\xampp\htdocs\amazon\_samples\cli-ec2_sorting_and_filtering.php(62): AmazonEC2->describe_images() #3 {main} thrown in C:\xampp\htdocs\amazon\lib\requestcore\requestcore.class.php on line 843
You have to include this:
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
if it already exists, you need to change it to false. Hope this helps.
I'm trying to test in PHP Amazon S3 on my localhost but keep getting the same error:
Fatal error: Uncaught exception 'cURL_Exception' with message 'cURL
resource: Resource id #69; cURL error: SSL certificate problem, verify
that the CA cert is OK. Details: error:14090086:SSL
routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed (cURL
error code 60). See http://curl.haxx.se/libcurl/c/libcurl-errors.html
for an explanation of error codes.' in
C:\wamp\www\mysite\application\libraries\awsphp\lib\requestcore\requestcore.class.php:829
Stack trace: #0
C:\wamp\www\mysite\application\libraries\awsphp\sdk.class.php(1034):
RequestCore->send_request() #1
C:\wamp\www\mysite\application\libraries\awsphp\services\sqs.class.php(250):
CFRuntime->authenticate('ListQueues', Array) #2
C:\wamp\www\mysite\application\libraries\awsphp\services\sqs.class.php(582):
AmazonSQS->authenticate('ListQueues', Array) #3
C:\wamp\www\mysite\application\controllers\uploads.php(33):
AmazonSQS->list_queues() #4 [internal function]: Uploads->aw3() #5
C:\wamp\www\mysite\system\core\CodeIgniter.php(359): call_user_func
in
C:\wamp\www\mysite\application\libraries\awsphp\lib\requestcore\requestcore.class.php
on line 829
Test code:
$sqs = new AmazonSQS();
$response = $sqs->list_queues();
var_dump($response->isOK());
I properly installed the AWS SDK to php files and enabled CURL and SSL on me local server. What can I do to make this work? I can't find any help online. I'm using wamp.
Get this file and save it to your hard drive. Call it cacert.pem.
Configure curl.cainfo in php.ini with the full path to the file downloaded in step 1.
Restart Apache.
I'll leave it as an exercise for the reader to find out why this fixes it, all the information you need can be found in the links above.
Are you running on Windows?
Did you take the time to run the SDK Compatibility Test that comes bundled with the SDK?
According to this post you can't work with Amazon AWS on localhost..