Posts

Showing posts with the label curl

curl: request is missing authentication header - authentication header there

curl: request is missing authentication header - authentication header there to Add more context: I am trying to make a curl request to the Seamless.gov API. On a different computer the same curl command works. However, when I run the curl command on my machine it doesn't work. curl -X GET -H "Content-Type: application/json" -H "Date: 1530285602" -H "Authorization: HMAC-SHA256 api_key=XXXXXXXX nonce=12335 signature=XXXXXXXXXXXXX" -d 'false' https://nycopp.seamlessdocs.com/api/form/CO1708XXXXXXXXXXXXX/elements I have the following version of curl : curl curl: stable 7.60.0 (bottled), HEAD [keg-only] Get a file from an HTTP, HTTPS or FTP server https://curl.haxx.se/ /usr/local/Cellar/curl/7.60.0 (423 files, 3MB) Poured from bottle on 2018-06-29 at 11:44:32 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/curl.rb ==> Dependencies Build: pkg-config ✔ Optional: openssl ✘, rtmpdump ✘, libssh2 ✘, c-ares ✘, libmetalink ✘, nghttp...

How to store curl response in a variable in PHP?

How to store curl response in a variable in PHP? I am working on an API. When I make request curl print the response on browser. So, my question is how to store response in variable? and How to insert it into database? <?php //API Url $url = 'http://114.143.206.69:803/StandardForwardStagingService.svc/GetAWBNumberGeneratedSeries'; //Initiate cURL. $ch = curl_init($url); //The JSON data. $jsonData = array( "BusinessUnit" => "ECOM", "ServiceType" => "FORWARD", "BatchID" => "Jopu7E9821" ); //Encode the array into JSON. $jsonDataEncoded = json_encode($jsonData); //Tell cURL that we want to send a POST request. curl_setopt($ch, CURLOPT_POST, 1); //Attach our encoded JSON string to the POST fields. curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded); //Set the content type to application/json curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','XBKey:******...

request using HTTP Outh 2 authentication with PHP curl not work?

request using HTTP Outh 2 authentication with PHP curl not work? I have set up a http request using PHP CURL with following code. PHP CURL <?php $para='{ "payment_method": "bacs", "payment_method_title": "Direct Bank Transfer", "set_paid": true, "billing": { "first_name": "John", "last_name": "Doe", "address_1": "969 Market", "address_2": "", "city": "San Francisco", "state": "CA", "postcode": "94103", "country": "US", "email": "john.doe@example.com", "phone": "(555) 555-5555" }, "shipping": { "first_name": "John", "last_name": "Doe", "address_1": "969 Market", "address_2...