Hostname was not found in DNS cache paypal curl reponse - php

I am trying to get PayPal transaction history, transaction details and PayPal balance using classic PHP API with CURL. I am running cron for this. I am getting correct response but getting following error also. what can be the reason and possible way to solve it?
Hostname was NOT found in DNS cache
Trying 173.0.82.83...
Connected to api-3t.sandbox.paypal.com (173.0.82.83) port 443 (#0)
successfully set certificate verify locations:
CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
Server certificate:
subject: C=US; ST=California; L=San Jose; O=PayPal, Inc.; OU=PayPal Production; CN=api-3t.sandbox.paypal.com
start date: 2013-08-01 00:00:00 GMT
expire date: 2015-09-18 23:59:59 GMT
issuer: C=US; O=VeriSign, Inc.; OU=VeriSign Trust Network; OU=Terms of use at https://www.verisign.com/rpa (c)10; CN=VeriSign Class 3 Secure Server CA - G3
SSL certificate verify ok.
> POST /nvp HTTP/1.1
Host: api-3t.sandbox.paypal.com
Accept: */*
Content-Length: 163
Content-Type: application/x-www-form-urlencoded
upload completely sent off: 163 out of 163 bytes < HTTP/1.1 200 OK < Date: Tue, 16 Jun 2015 06:00:14 GMT
Server Apache is not blacklisted
Server: Apache
Connection: close
Content-Length: 147
< Set-Cookie:X-PP-SILOVER=name%3DSANDBOX3.API.1%26silo_version%3D880%26app%3Dappdispatcher_apit%26TIME%3D1857781589; domain=.paypal.com; path=/; Secure; HttpOnly < Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT < Content-Type: text/plain; charset=utf-8 <
* Closing connection 0

Yes, I got solution. I lowered curl version to below 7.33 and It worked for me.

Related

PHP curl_errno returns 7 even when request is successful

I'm trying to integrate authorize.net (AIM) using the official PHP SDK v2.0.0 and I'm seeing some strange behaviors:
curl_exec() returns false even when the request is successful and CURLOPT_RETURNTRANSFER is set to true.
curl_errno is returns 7 (Failed to connect() to host or proxy) for the same request.
I know request is successful since:
I can see the transaction is successfully recorded at authorize.net
Setting CURLOPT_RETURNTRANSFER to false causes the JSON response from authorize.net to be printed
curl_getinfo() shows HTTP status code = 200
Anyone experience this type of behavior with cURL? I'm not sure what I'm missing.
EDIT: Added output with CURLOPT_VERBOSE set
* Trying 198.241.206.22:443...
* Connected to apitest.authorize.net (198.241.206.22) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /home/app/demo/assets/lib/anet_sdk_2.0.0/lib/ssl/cert.pem
CApath: none
* SSL connection using TLSv1.2 / AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: C=US; ST=California; L=Foster City; O=Authorize.Net; CN=*.authorize.net
* start date: Feb 5 20:44:08 2020 GMT
* expire date: Mar 15 21:14:08 2021 GMT
* subjectAltName: host "apitest.authorize.net" matched cert's "*.authorize.net"
* issuer: C=US; O=Entrust, Inc.; OU=See www.entrust.net/legal-terms; OU=(c) 2012 Entrust, Inc. - for authorized use only; CN=Entrust Certification Authority - L1K
* SSL certificate verify ok.
> POST /xml/v1/request.api HTTP/1.1
Host: apitest.authorize.net
Accept: */*
Content-Type: text/json
Content-Length: 1458
* upload completely sent off: 1458 out of 1458 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Cache-Control: no-store
< Pragma: no-cache
< Content-Type: application/json; charset=utf-8
< X-OPNET-Transaction-Trace: a2_fe4a070f-cf07-47d7-8e9e-c8a703920de5-5628-7089051
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Headers: x-requested-with,cache-control,content-type,origin,method,SOAPAction
< Access-Control-Allow-Methods: PUT,OPTIONS,POST,GET
< Access-Control-Allow-Origin: *
< Strict-Transport-Security: max-age=31536000
< X-Cnection: close
< Date: Sat, 12 Sep 2020 10:40:48 GMT
< Content-Length: 512
<
* Connection #0 to host apitest.authorize.net left intact

send a terminal curl post request to a login

I've been trying to send a post request to this login page https://njit2.mrooms.net/auth/saml2/login.php but it doesn't successfully log me in even though the credentials are correct.
here is the full command I'm using in my terminal:
curl --data "j_username=user&j_password=pass&_eventId_proceed=" https://njit2.mrooms.net/auth/saml2/login.php
If you can spot anything that I'm not getting then it'll be much appreciated. Thanks.
edit: with -v flag this is what I get in the beginning of the response:
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 34.192.104.23...
* Connected to njit2.mrooms.net (34.192.104.23) port 443 (#0)
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 597 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
* server certificate verification OK
* server certificate status verification SKIPPED
* common name: *.mrooms.net (matched)
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: RSA
* certificate version: #3
* subject: OU=Domain Control Validated,OU=PositiveSSL Wildcard,CN=*.mrooms.net
* start date: Thu, 30 Nov 2017 00:00:00 GMT
* expire date: Thu, 17 Jan 2019 23:59:59 GMT
* issuer: C=GB,ST=Greater Manchester,L=Salford,O=COMODO CA Limited,CN=COMODO RSA Domain Validation Secure Server CA
* compression: NULL
* ALPN, server did not agree to a protocol
> POST /auth/saml2/login.php HTTP/1.1
> Host: njit2.mrooms.net
> User-Agent: curl/7.47.0
> Accept: */*
> Content-Length: 54
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 54 out of 54 bytes
< HTTP/1.1 200 OK
< Cache-Control: no-store, no-cache, must-revalidate
< Content-Type: text/html; charset=utf-8
< Date: Mon, 17 Sep 2018 05:54:50 GMT
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Pragma: no-cache
< Server: Apache
< Set-Cookie: MoodleSession=fe6dc1b41104b83d391d8700d60f9308; path=/
< Set-Cookie: MDL_SSP_SessID=402ef69749885fa74956365b087e5747; path=/; HttpOnly
< Vary: Accept-Encoding
< X-Powered-By: PHP/7.1.15-1+ubuntu14.04.1+deb.sury.org+2
< transfer-encoding: chunked
< Connection: keep-alive

Paypal connection fails in PHP (Dockerized website)

In my php website the page redirection associated with paypal is not working by giving the following in the apache error log. I have exposed port 80 as well as 443 in Dockerfile. Rest of the things are working fine in the site and the site with the same code is running fine in my local apache server.
* Trying 173.0.82.83...
* Connected to api-3t.sandbox.paypal.com (173.0.82.83) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection:
ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:#STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* SSL connection using TLSv1.2 / AES256-SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: C=US; ST=California; L=San Jose; O=PayPal, Inc.; OU=PayPal
Production; CN=api-3t.sandbox.paypal.com
* start date: Jan 14 00:00:00 2016 GMT
* expire date: Jan 14 23:59:59 2018 GMT
* subjectAltName: api-3t.sandbox.paypal.com matched
* issuer: C=US; O=Symantec Corporation; OU=Symantec Trust Network;
CN=Symantec Class 3 Secure Server CA - G4
* SSL certificate verify ok.
> POST /nvp HTTP/1.1
Host: api-3t.sandbox.paypal.com
Accept: */*
Content-Length: 655
Content-Type: application/x-www-form-urlencoded
* upload completely sent off: 655 out of 655 bytes
< HTTP/1.1 200 OK
< Date: Mon, 04 Sep 2017 08:07:48 GMT
< Server: Apache
< X-SLR-RETRY-API: SetExpressCheckout
< X-PAYPAL-OPERATION-NAME: SetExpressCheckout
< X-PAYPAL-API-RC:
< Connection: close
< HTTP_X_PP_AZ_LOCATOR: sandbox.slc
< Paypal-Debug-Id: 6692e8ec22b4a
< Set-Cookie: X-PP SILOVER=name%3DSANDBOX3.API.1%26silo_version%3D1880%26app%3Dappdispatcher_apit%26TIME%3D3691621721%26HTTP_X_PP_AZ_LOCATOR%3Dsandbox.slc; Expires=Mon, 04 Sep 2017 08:37:56 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
< Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT
< Content-Length: 137
< Content-Type: text/plain; charset=utf-8
<
* Closing connection 0
Please help me in fixing this error.
I can find error logs under apache in my local and in case of success scenarios nothing is being logged
I am using Ubuntu 17.04 installed in oracle VM. I am not able to ping paypal sandbox URL from my server in VM. If I am trying to ping the URL from my local commandprompt, I am getting Request Timed out inspite of successful paypal connection in my local apache (from XAMP).

PHP curl get negotiated TLS version

I am trying to check whether my requests are using TLS version >1. While curl command line gives me this information in the verbose output, php does not seem to be.
This is my PHP curl verbose output when the connection is initiated
* About to connect() to *** port 443 (#0)
* Trying 88.*.*.*... * connected
* Connected to *** (88.*.*.*) port 443 (#0)
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* SSL connection using TLS_RSA_WITH_AES_256_CBC_SHA
* Server certificate:
* subject: ***
* start date: Dec 21 18:43:21 2015 GMT
* expire date: Dec 21 18:38:18 2016 GMT
* common name: ***
* issuer: CN=Verizon Akamai SureServer CA G14-SHA2,OU=Cybertrust,O=Verizon Enterprise Solutions,L=Amsterdam,C=NL
* Server auth using Basic with user '***'
> GET /my/path HTTP/1.1
Authorization: ***
Host: ***
Accept: */*
< HTTP/1.1 200 OK
< Server: ***
< Content-Type: application/json;charset=utf-8
< Content-Length: 3733
< Expires: Wed, 03 Feb 2016 15:24:49 GMT
< Cache-Control: max-age=0, no-cache, no-store
< Pragma: no-cache
< Date: Wed, 03 Feb 2016 15:24:49 GMT
< Connection: keep-alive
<
* Connection #0 to host *** left intact
* Closing connection #0
How can I say what is the TLS used in a connection? I would like to avoid using any 3rd party options like making request to https://www.howsmyssl.com/a/check

format response for api call back

I am using php curl to receive data (ssl certificate) inspection but the data that comes back is one big lump of data in (according to firebug) it's in html format .. here is a sample of the output
HTTP/1.1 200 OK
Date: Mon, 13 Apr 2015 14:10:05 GMT
Server: Apache
Set-Cookie: v1st=9C74FC61F2FB5493; path=/; expires=Wed, 19 Feb 2020 14:28:00 GMT; domain=.geotrust.com
Set-Cookie: v1st=9C74FC61F2FB5493; path=/; expires=Wed, 19 Feb 2020 14:28:00 GMT; domain=.geotrust.com
X-Powered-By: PHP/5.2.13
Expires: Wed, 13 May 2015 14:10:05 GMT
Vary: Accept-Encoding
Cache-Control: max-age=604800, public
Content-Type: text/html
* Rebuilt URL to: https://www.geotrust.com/
* Hostname was found in DNS cache
* Trying 69.58.181.102...
* Connected to www.geotrust.com (69.58.181.102) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: C:\xampp\htdocs\labs\test2\cacert.pem CApath: none
* SSL connection using TLSv1.0 / DHE-RSA-AES256-SHA
* --- Certificate chain
* 0 Subject: 1.3.6.1.4.1.311.60.2.1.3=US; 1.3.6.1.4.1.311.60.2.1.2=Delaware; C=US; ST=California; L=Mountain View; businessCategory=Private Organization; serialNumber=3479750; O=GeoTrust, Inc.; OU=Infrastructure Operations; CN=www.geotrust.com
* Issuer: C=US; O=GeoTrust Inc.; CN=GeoTrust Extended Validation SHA256 SSL CA
* Version: 3 (0x2)
* Serial Number:
* Signature Algorithm: sha256WithRSAEncryption
* Start date: 2015-02-04 00:00:00 GMT
* Expire date: 2017-02-03 23:59:59 GMT
It seems like each line is separated by a wildcard symbol * .. how can I cleanly output this data? currently i am just using
success: function (response) {
$('#ajaxResponse').html(response);
Would be great if i could display certain data only but not sure how.
-- Here is the firebug --
use a <pre> tag to indicate that it's pre-formatted.
$("#ajaxResponse").html('<pre>' + response + '</pre>');
if you want to format it based on the assumption that they are separated by * then something like this might work for you:
$('#ajaxResponse').html(response.replace(/\*/g, '<br />'));
EXAMPLE: http://jsfiddle.net/mjgwcmnt/

Categories