eWay Responsive Shared Page integration in PHP by Using CURL - php

I am trying to integrate eWay payment gateway (Responsive Shared Page) by using Curl(json) in php.it is working fine in my virtual machine that is ubuntu12.0
but curl not getting any response if i exceute same code on xampp server.
What is problem with curl?
Thanks in advance.

While it would be helpful if you could at least provide the error you are getting (details for finding the error log are here), most XAMPP issues are because it either doesn't have openssl enabled or it isn't loading the CA bundle to verify SSLs with. The solutions can be found in the following:
Enable OpenSSL with XAMPP
Adding the CA bundle to XAMPP

Related

SSL Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE

I uploaded my website build with laravel on ubuntu server and used Instamojo to accept payments. I have purchased SSL from Namecheap (PositiveSSL).
The problem is my webhook URL is not working. I tried accessing the URL through Postman and got an error 'Could not get any response'. The screenshot of Postman Console-
This can be caused by failing to bundle the intermediate certificates with the server certificate. You will have at least one intermediate certificate that needs to be bundled with you server cert.
For more information please read the Complete Tutorial for installing SSL on Apache

Why does my twilio web application work in XAMPP but not in AZURE

I've created an application in php that sends texts out to people using the twilio api. It works perfectly in XAMPP but the php code doesn't run in Azure. Everytime I call it I get an error message saying "Failed to load resource: the server responded with a status of 500 (Internal Server Error)".
Is there a way I can solve this problem without having to create my own virtual server?
Usually, when we get 500 response, it means we get some errors on server scripts. And we can set the display_errors=On in PHP runtime on our Azure Web Apps for easy troubleshooting. Refer to https://azure.microsoft.com/en-in/documentation/articles/web-sites-php-configure/#how-to-change-the-built-in-php-configurations for details.
And you may check whether your application on Azure Web Apps has successfully installed the twilio lib. You can leverage composer to configure the sdk in composer.json, then when you deploy your application to Azure via Git, Azure service will install the dependencies in composer.json file automatically during the deployment task.
You can leverage require 'vendor/autoload.php' to load all the dependencies.
At the first time during the test, I got the following error:
Fatal error: Uncaught exception Services_Twilio_TinyHttpException with message SSL certificate problem...
So it may be the issue on your side too, you can add the certificate in PHP on Azure Web Apps, please refer to https://blogs.msdn.microsoft.com/azureossds/2015/06/12/verify-peer-certificate-from-php-curl-for-azure-apps/ for detailed steps.
Otherwise, you can simply edit TinyHttp.php in twilio lib:
add CURLOPT_SSL_VERIFYPEER => FALSE, at $opts array.
Refer to Twilio PHP - SSL certificate: self signed certificate in certificate chain for the same issue.
They have many possibles:
Your Azure running PHP in ISS Server, then you need convert your .htaccess file to web.config, simple, just go to website in IIS and on import your .htaccess file, IIS will convert your .htaccess in web.config.
Permissions on folder you are running.
PHP versions, check your PHP version on xampp and compare to PHP version on Azure. Your code can be compatible in your PHP Xampp but not in PHP Azure.
Extensions PHP, it is possible that your xampp has extensions for PHP enable that your Azure not are enable, like file_info, etc...

Azure Website SSL

I not sure why i'm getting this error after i migrated my wordpress to Azure Websites. Previously the site working perfectly without any issue. I tried to install SSL (from comodo) to Azure Websites, top up SSL from cloudflare but it still not working.
MailChimp API Response : SSL certificate problem: unable to get local issuer certificate
Some online user said need to define the php.ini, but we have no access over the file hence i'm adding the following line to wp-config.php
ini_set('curl.cainfo', "cacert.pem");
the file located at same directory as wp-config. but it's still not working. please advice.
(I'm using custom domain)
You can use a custom PHP runtime, and then you can change php.ini and any of the PHP_INI_SYSTEM configurations.
Check here for details on how to use a custom php runtime, but basically you will upload the php version as a part of your site, and set is as the handler for *.php in Portal.

Impossible SSL CAS-certificates with phpCAS and examples. It only works without SSL server verification

I am doing a CAS integration with a project that I am doing with my university. The final integration should be made with symfony2, however first I need to make the example code working.
I finally get working the example_simple.php example with phpCAS 1.3.2 , however the directive:
phpCAS::setNoCasServerValidation();
is the enabled one. I think I should use instead:
phpCAS::setCasServerCACert($cas_server_ca_cert_path);
However when I enable this second one (and disable the other) then the authorization does not work anymore. Here is the relevant output line error of the log:
could not open URL 'https://cas_server.fi/cas/serviceValidate?service=http%3A%2F%2Flocalhost%2Fphpcas2%2Fdocs%2Fexamples%2Fexample_simple.php&ticket=ST-115606-M1Omd1cHWzbLbmxa1nYV-cas' to validate (CURL error #60: SSL certificate problem: unable to get local issuer certificate) [Client.php:2763]
The cas server provided me two .crt files:
MYCASRootCA.crt
MYCASLinuxSUBCA.crt
And they are suppose to be installed in my system (Ubuntu 13.10). They are in different places, such a /etc/ssl/certs/MYCASLinuxSUBCA.pem but also:
/usr/share/ca-certificates/lut/MYCASRootCA.crt
/usr/share/ca-certificates/lut/MYCASLinuxSUBCA.crt
So assuming that the variable $cas_server_ca_cert_path has to have one of these .crt files or .pem dirs (such a /usr/share/ca-certificates/lut/MYCASLinuxSUBCA.crt) I cannot make it work. What I am doing it wrong? My client-server (no the cas server) is in my localhost. Is it a problem? Should I avoid use setCasServerCACert command? Why is it happening?
I've also tried to use the curl-ca-bundle.crt certificate provided by my XAMP instalation (Xampp 1.8.3).
I am a little bit lost with certificates as you can see.
I read about problems with phpCAS and recent Ubuntu versions in https://github.com/Jasig/phpCAS/issues?state=open. However I cannot make this working with the master code, even without certification (by default).
Any ideas would be appreciated...
I have found the solution asking in the github library: https://github.com/Jasig/phpCAS/issues/119
The reason is that the curl binary used by PHP in my xampp installation is different from the system's curl binary. The system one has access to /etc/ssl/certs/ certificates, but the xampp curl does not have (unless you don't indicate it, of course). By default, it searches in a special certificate-bundle-file.
Finally I have found the real certificate for my cas-server and I am using it, however maybe you want to use other proposed solution at the end of the discussion thread if you are having a similar problem.

PHP OAuth Extension "Failure when receiving data from the peer"

I am using the PHP OAuth extension to connect to the Netflix API and pull data through a GET request.
Running the request on my local machine results in a successful try and the correct data returned.
However, upon pushing the request up to our 'live' server, I've immediately run into issues with the PHP OAuth extension failing.
I am using version 1.2.2 of the extension with curl as my request method (libcurl is also installed). My PHP code to call the OAuth fetch is:
$oauth = new OAuth($this->key, $this->secret);
$resource = $oauth->fetch($url, array('v' => '2.0', 'include_tms' => 'true'));
$this->_writeFile($oauth->getLastResponse());
Again, this exact code works 100% on my local dev machine (Mac running OS X Lion, installed php-oauth through MacPorts ... also version 1.2.2 ... PHP 5.3.8). However, when running on our server (Debian Linux, PHP 5.3.3, installed php-oauth through apt-get) I receive the following error:
PHP Fatal error: Uncaught exception 'OAuthException' with message 'making the request failed (Failure when receiving data from the peer)' in /var/www/familymedia/application/Services/Netflix.php:23
I'm really not sure what to make of this error.
Some further info:
We currently make successful cURL requests from our server to other API services and return back good information without issue on an hourly basis. However, none of those services authenticate through OAuth, so none of them required the OAuth extension and I ran them straight with php curl.
I have a feeling that there is some sort of setup issue with the php-oauth extension on our live server that MacPorts "magically" solved for me during install on my local machine ... but I cannot find any install or configuration advice/instruction/etc that has helped.
Hoping someone has an answer or a place to point me for further discovery toward an answer ...
Thought I'd update this question with the answer found: the company was specifically blocking inbound communication from Netflix. IT solved the issue. Not a very exciting answer, but that's what it was.

Categories