Category : curl

I can make the request I want using cURL, but it’s failing when I try to replicate it using Laravel (returning 404). I’ve ensured the data being sent is identical. Here’s the cURL: curl –request POST –url https://www.api-provider.com/api/v2/access_keys –header ‘Authorization: Bearer 53d9814ed1385f44e6d5ed24979e11c2f7da654b40’ –header ‘Content-Type: application/json’ –data ‘{"access_key":{"key":"Lmy48Z0vA89","rate_ids":["[]"],"listing_id":"5de8f56797209ffbe","quantity":1,"is_active":true}}’ Here’s the Laravel equivalent (following Guzzle’s documentation): $response ..

Read more

I’m using curl operation in laraval controller .My api is working fine in postman but not returning response in curl. I have tried as $am_summary_details=Curl::to(‘https://iapi.test.com/KPIRestService.svc/GetDetailsByUserName’) ->withOption("USERPWD","REPOSITOR:36A11558-DDrfB5-4977-8A50-5871494917D9",’FOLLOWLOCATION’, true) ->withData([ ‘UserName’=>$user_name, ‘summaryType’=>’AM’ ]) ->asJson() ->post(); not getting response. This code corks fine with minimal data but not with bulk data.Is it required to increase size. Sourc..

Read more

I am trying to make a php curl request to my laravel api Here’s the curl function function CallAPI($method, $url, $data = false) { $curl = curl_init(); switch ($method) { case "POST": curl_setopt($curl, CURLOPT_POST, 1); if ($data) curl_setopt($curl, CURLOPT_POSTFIELDS, $data); break; case "PUT": curl_setopt($curl, CURLOPT_PUT, 1); break; default: if ($data) $url = sprintf("%s?%s", $url, http_build_query($data)); ..

Read more

In laravel 7 app I read data with curl and expect returned data be in json format : $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, $search_web_url); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json","charset=windows-1251")) $resp = curl_exec($ch); Log::info( ‘-1 $resp ::’ . print_r( $resp, true ) ); But $resp is a string starting with rows : <?xml version="1.0" ..

Read more

I’m trying to make an API request between two laravel websites. For the first website, this is how it’s structured. api.php use IlluminateSupportFacadesRoute; Route::group([‘prefix’ => ‘v1’], function () { Route::get(‘getCountries’, ‘[email protected]’); }); ApiController public function getCountries() { $country = Country::get(); $country->makeHidden([‘flag’]); //svg return $country; } This returns on postman using GET https://website.com/api/v1/getCountries: [{"id":1,"iso":"AF","name":"AFGHANISTAN","nicename":"Afghanistan","iso3":"AFG","numcode":4,"phonecode":93,"created_at":null,"updated_at":null},{"id":2,"iso":"AL","name":"ALBANIA","nicename":"Albania","iso3":"ALB","numcode":8,"phonecode":355,"created_at":null,"updated_at":null},{"id":3,"iso":"DZ","name":"ALGERIA","nicename":"Algeria","iso3":"DZA","numcode":12,"phonecode":213,"created_at":null,"updated_at":null},{"id":4,"iso":"AS","name":"AMERICAN SAMOA","nicename":"American Samoa","iso3":"ASM","numcode":16,"phonecode":1684,"created_at":null,"updated_at":null},{"id":5,"iso":"AD","name":"ANDORRA","nicename":" ..

Read more

I am trying to post an image (attachment) and message from local database to localbitcoins trade chat, but it is returning me an error. Yes, API keys are valid and working with other methods. {"error": {"message": "HMAC authentication key and signature was given, but they are invalid.", "error_code": 41}} I’m not sure what I’m doing ..

Read more

I have a laravel project on hostinger.com. I need to check proxy with cURL, I make request and get possitive result when I dont use CURLOPT_PROXY. In another case i recieve bool(false) I will add the code: <?php namespace AppHttpControllers; use IlluminateHttpRequest; use IlluminateSupportFacadesDB; class Test extends Controller { function checkAll(Request $request){ $id= $request->id; $data ..

Read more

I am having issues in accessing contact from Xero. I keep getting an error – AuthorizationUnsuccessful Below please find the code I am using to send my request as well as the response I am getting: ‘scopes’ => ( ‘openid’, ’email’, ‘profile’, ‘offline_access’, ‘accounting.settings’, ‘accounting.contacts’ ) in my xero config file Request passing in Postman ..

Read more

I want to use finerworks api and my curl code is here $data1 = array( ‘web_api_key’ => ‘********-****-****-*****-************’, ‘app_key’ => ‘********-****-****-*****-************’, ); $data2[‘credentials’] = $data1; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.finerworks.com/v3/test_my_credentials", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30000, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => json_encode($data2), CURLOPT_HTTPHEADER ..

Read more

How can i convert this curl command so that it can be usable in Laravel? curl -H "Authorization: Basic MTc5YjdlYTAzNTM0NDUwMWE3ZDQ3MDAzZWFmNWVkMDY6OTQ5YmIwOGI5MzhjNGI5Yzk1ZGZiNzlkMjM0ZTU1NmM=" -d grant_type=refresh_token -d refresh_token=AQBivXhWFiAzMi7_eujyGvy84066N9Pu-tocQaCo8l20hUy2Bqt3KFlSXy3BrL998bkgCdCg3MUQvOf7ZE2XTmVESd9FxrQKRSrGvXriGjetbXwonBaK3wOvgaa-ZX5qPzg https://accounts.spotify.com/api/token Sourc..

Read more

This is the output I receive after the curl call. I am trying to access a SOAP service using the following code it works on SOAP CI but does not works when I try to hit it using curl. I have even tried using it https://github.com/notfalsedev/laravel-soap. function callSoapService() { $serviceURL = ‘http://fglpg001.futuregenerali.in/BO/Service.svc’; $requestString = "<Root> ..

Read more