I am using nusoap to connect Eway legacy Api. Suddenly Eway enforce TLS 1.2 on their side. So I have set open ssl 1.0 and TLS 1.2 in my server.
From that server I am connecting Eway rapid api which is working fine. As both Legacy and Rapid api needs TLS 1.2 and rapid is working fine that means our server setup i ok. But this legacy api connection is not working.
I need to enforce TLS 1.2 by code when I am connecting Eway legacy API using nusoap.
Code Example -
<?php
$client = new nusoap_client("https://www.eway.com.au/gateway/rebill/manageRebill.asmx");
$client->namespaces['man'] = 'http://www.eway.com.au/gateway/rebill/manageRebill';
$headers = "<man:eWAYHeader><man:eWAYCustomerID>****</man:eWAYCustomerID><man:Username>****</man:Username><man:Password>****</man:Password></man:eWAYHeader>";
$client->setHeaders($headers);
$requestbody = array();
$soapactionUrl = 'http://www.eway.com.au/gateway/rebill/manageRebill/';
$requestbody['man:RebillCustomerID'] = $eway_rebill_customer_id;
$requestbody['man:RebillID'] = $eway_rebill_id;
$soapaction = 'QueryRebillEvent';
$client = $this->_creatEwayRebillRequestHeader();
$result = $client->call('man:'.$soapaction, $requestbody, '', $soapactionUrl.$soapaction,true);
$err_msg = $client->getError();
echo $err_msg;
?>
The error massage what I am getting is -
wsdl error: Getting https://www.eway.com.au/gateway/rebill/manageRebill.asmx - HTTP ERROR: Unsupported HTTP response status 403 Forbidden (soapclient->response has contents of the response)
I am sure about my credentials, also eway support team also told me to enforce TLS 1.2 to solve the issue. But I don't know how to enforce TLS 1.2 in the nusoap library.
It appears you can tell NuSOAP to use CURL. So modifying the setup slightly should do the trick
$client = new nusoap_client("https://www.eway.com.au/gateway/rebill/manageRebill.asmx");
$client->setUseCURL(true);
$client->setCurlOption(CURLOPT_SSLVERSION, '6'); // TLS 1.2
I don't have a way to test this, but I based it on the NuSOAP class found in GitHub. This works for CURL so it should work here.
Related
I use http client component in my project symfony for external apis but I found this error when i test api:
SSL connect error for url
configuration of component is basic configuration and also create for request if simple with request method
$client = $this->client->request(
'GET',
$this->getUrl($route) . $query,
$this->options
);
I use a certificate for https and I enabled openssl extension, also I try to user verify_peer option in options parameters but also error.
How to fix this error?
I am trying to hit API endpoint from my Laravel 5.8.* project.
I am using Guzzle 6.0 with PHP version 7.1.3.
When I run my project in local machine, I get the API response successfully.
But after uploading the project to liver server, I could not get the API response.
I get the response "cURL error 7: Failed to connect to xx.xx.xx.xx port 3333: Connection refused (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)".
The code that I use is as follows.
$client = new GuzzleHttp\Client();
$res = $client->request('GET', 'http://xx.xx.xx.xx:3333/api/getrecords', [
'tbl' => ['user', 'activity']
]);
echo $res->getMessage();
The same code is working perfectly in local machine but not in live server.
My Server is Linux server.
Did you have any proxy configured in your server? If so, try to set a proxy in your guzzle request: Guzzle proxy docs
Basically, you have to set an array with the proxy.
$client->request('GET', '/', ['proxy' => 'tcp://localhost:8125']);
you are trying to make request using port 3333. This port 3333 needs to be open in your machine only then you will be able to make request from this port.
I'm using GuzzHttp in my laravel project to post some data to an API. In my local enviroment I have to to create my client with the cacert.pem file verification like this:
$client = new \GuzzleHttp\Client(['verify' => 'C:\wamp64\bin\php\php7.2.14\cacert.pem']);
But I can't do so on my shared hosting. So, removing that verification:
$client = new \GuzzleHttp\Client();
Results on an internal server error:
[2019-06-11 15:17:10] local.ERROR: GuzzleHttp\Exception\ServerException: Server error: `POST https://pruebas2.mayoristaseguridad.es/tiendaseguridad/02-ConectorLaravelPrestashop/ConectorCategorias.php` resulted in a `500 Internal Server Error` response in /home/admin/web/iberoseguridad.eu/public_html/csv_products/vendor/guzzle/guzzlehttp/guzzle/src/Exception/RequestException.php:113
Is there a way to fix this error?
Not sure if this will help, here it goes anyways
// Disable validation entirely (don't do this!).
$client->request('GET', '/', ['verify' => false]);
Guzzle verify api
This ended up being a remote server error, not mine. I just had to communicate that error with the server's maintainer and now it works just fine.
I am trying to use the Asana PHP API to build a browser project for personal use, but I am facing problems with connecting to the API.
This is the response i get when trying to fetch the user data from the API.
Fatal error: Uncaught exception 'Httpful\Exception\ConnectionErrorException' with message 'Unable to connect to "https://app.asana.com/api/1.0/users/me": 35 Unknown SSL protocol error in connection to app.asana.com:443 ' in php-asana\vendor\nategood\httpful\src\Httpful\Request.php:208
Here is the code I am using for initializing and fetching the data
require 'php-asana/vendor/autoload.php';
$client = Asana\Client::accessToken(PERSONAL_ACCESS_TOKEN);
$users = $client->users->me();
print_r($users);
The app is set up on my local server. Is it necessary for the client server to have SSL in order to fetch data from the Asana API or am I doing something wrong?
You might be using a deprecated version of TLS to do your requests, please see Asana is now deactivating TLS 1.0
Additionally, the library you are using may not support secure connections
I've got a problem with SOAP and SSL.
When I create a SOAP client with normal wsdl (http), it runs ok. But when I connect with a SSL wsdl (https) it's got problem.
I tried the same code to connect to the https wsdl at my localhost, it's OK. But it doesn't work if that code run under my server.
My server is running Centos, PHP 5.3.8. Can you show me how to config PHP to run SOAP with SSL. Below is my current code:
<?php
// where BKTransactionAPI extends SoapClient...
$bk = new BKTransactionAPI("https://www.baokim.vn/services/transaction_api/init?wsdl");
$info_topup = new TopupToMerchantRequest();
$info_topup->card_id = $service;
$info_topup->pin_field = $pin;
$info_topup->transaction_id = $transaction_id;
$result = new TopupToMerchantResponse();
$result = $bk->DoTopupToMerchant($info_topup);
?>