Category : guzzle

I am trying to post an object using Guzzle laravel which I pass it using form submit from my view but when I do it says INVALID FORMAT Json Cannot be Parsed My View <form method="POST" action="comparePrices"> @csrf <input type="text" name="datas" id="textsss"/> <input type="submit" value="save"/> </form> But when I post it via postman it works ..

Read more

public static function send() { $products = Product::where(‘active’, 1)->get([‘id_product’, ‘price’, ‘reference’])->load([‘images’, ‘lang’]); // loop for all products and sending to API $number_of_products = count($products); $start = 0; $end = 70; for ($a = 0; $a < ceil($number_of_products/70); $a++) { for ($i = $start; $i < $end; $i++) { // loop for all images in product ..

Read more

I’m making a post request with postman that works: curl –location –request POST ‘https://example.com/v1/oauth2/token’ –header ‘Authorization: Basic ZjLWMyMmItNDk1MS04ZjQzLTNlZmM1NDAyZjkzZA==’ –header ‘Content-Type: application/x-www-form-urlencoded’ –data-urlencode ‘grant_type=client_credentials’ I’m trying to do it with Laravel 8: $res = Http::withBasicAuth("user", "***") ->withOptions([ ‘debug’ => true, ‘verify’ => false]) ->withHeaders([ "Content-Type"=> "application/x-www-form-urlencoded" ]) ->post(env("URL") . "/v1/oauth2/token", [ ‘form_params’ => [ ‘grant_type’ => ..

Read more

I am using Guzzle for retrieving data from Amadeus. It works fine with Postman and also if I call with Ajax it works fine but when I want to retrieve data from the controller it says bad request. Postman public function agentsTicket(Request $request) { $client = new Client(); try { $res = $client->Get(‘https://test.api.amadeus.com/v2/shopping/flight-offers’, [ ‘headers’ ..

Read more

I am building a class wrapper around the themoviedb.org api. I’m using guzzle 7 for the requests, but it seems that it is not throwing any exception. class TMDBScraper{ private string $apiKey; private string $language; private Client $client; private const API_URL = "http://api.themoviedb.org/3/"; private const IMAGE_URL = "http://image.tmdb.org/t/p/"; private const POSTER_PATH_SIZE = "w500"; private const ..

Read more

I’m trying to send the following data to a REST API with Guzzzle { “documents”: { “id_proprietaire”: 28, “nom_proprietaire”: “rash”, “prenom_proprietaire”: “rash”, “code_identification”: “9LS9PB094MIL9CPL”, “dossier_initial”: “path_to_data” }, “dossier_final”: null } But I don’t find how to use multipart and json requests together. Can someone help? This is what I have done and I got a ..

Read more

I am new to laravel and this is my first integration. I am sending some data like email and name of users to smartrmail which is like mailchimp . This is my api docs: https://docs.smartrmail.com/en/articles/636534-api-overview https://docs.smartrmail.com/en/collections/30284-api I want to create a new user. Each time I send the request to create New subscriber I get ..

Read more

I have an api post request to smartrmail : https://docs.smartrmail.com/en/articles/636612-manage-subscriber-lists I am using Guzzle for this. Each time I make an request i get this error in my browser Server error: `POST https://go.smartrmail.com/api/v1/lists` resulted in a `500 Internal Server Error` response: {"error":"param is missing or the value is empty: list"} Below is my code Route::get(‘smartrmail’,function(){ ..

Read more

I want to pass the id from the controller to route but I’m having trouble with it. I am a newbie at this so I would really appreciate your help! Controller: public function fetchVideo(Request $request) { $client = new Client(); $input = $request->all(); $headers = [ ‘Authorization’ => ‘Bearer ‘.$input[‘token’], ‘Content-type’ => ‘application/json’, ‘Accept’ => ..

Read more

So here’s my problem : I use the EOD Financial api to get data on a stock, on a Laravel/Vue.js project. On a Vue Component, I use axios to make a get Request like this : const response1 = await axios.get("/getHistoricalDataNAME/"+String(self.stock.code)+’.’+String(self.stock.exchange)) .then((response) => { with the function getHistoricalDataNAME being : public function getHistoricalDataISIN(String $ISIN) { ..

Read more

composer require mews/laravel-pos Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/ Using version ^0.3.8 for mews/laravel-pos ./composer.json has been updated Loading composer repositories with package information Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will ..

Read more

This is the our list service api. POST /createList /start process to create list. Return listId/ GET /checkList/listId /returns status of the list. Processing, completed etc/ GET /getList/idlistId /if status completed return payload/ Do while or cron job can be used as a solution. But I am looking for the most optimal solution that can ..

Read more

I’m trying to scape a webpage using Laravel, Goutte, and Guzzle. I’m trying to pass an instance of guzzle into Goutte but my web server keeps trying to use SymfonyContractsHttpClientHttpClientInterfac. Here’s the exact error I’m getting: Argument 1 passed to SymfonyComponentBrowserKitHttpBrowser::__construct() must be an instance of SymfonyContractsHttpClientHttpClientInterface or null, instance of GuzzleHttpClient given, called in ..

Read more

I’m a beginner. I have arrays in Jquery which loop through table data: $("#myForm").on("submit", function (e) { e.preventDefault();//stop submit event var arrA = []; var b; $("#example2 tr").each(function() { var aData = $(this).find(‘.amount’); b = $(this).find(‘.b’).text(); var a = []; if (aData.length > 0) { aData.each(function() { arrA.push(parseInt($(this).text())); }); } }); }); In Controller: public ..

Read more

I want to use this inside of laravel api : https://github.com/tg-bot-api/bot-api-base I made my controller and this is what i made : class ContactUsController extends Controller { public function contactUs(Request $request){ $botKey = ‘***********************************************’; $requestFactory = new HttpFactoryGuzzleRequestFactory(); $streamFactory = new HttpFactoryGuzzleStreamFactory(); $client = new HttpAdapterGuzzle6Client(); $apiClient = new TgBotApiBotApiBaseApiClient($requestFactory, $streamFactory, $client); $bot = new ..

Read more