How can I access variables within a Guzzle promise "then"?

I’m trying to make use of Guzzle to send two POST requests one after another (first to create a user, then to assign them a segment) and I seem to be struggling with accessing the variables I’ve defined throughout. I’ve got the following in my function: $data = [ ’email’ => $email, ]; if (!empty($name))… Read More How can I access variables within a Guzzle promise "then"?

Post request in laravel using guzzle

I am trying to notify a slack channel whenever a new order appears in our site. But I am struggling to perform this CURL request in Laravel curl -X POST –data-urlencode "payload={\"channel\": \"#new-order\", \"username\": \"product-notifier\", \"text\": \"New Orders: \n https://mission-control.airbringr.com/orders/item/411980\", \"icon_emoji\": \":smiley:\"}" https://hooks.slack.com/services/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 I’ve been trying to come up with a solution: public function slack(Request… Read More Post request in laravel using guzzle

How to find a given value in a string Laravel

I get a string on request, using guzzle $import = new ServerInviteClient(); $response = $import->client->request(‘GET’, ‘cB2EDPJ9wr’); $items = $response->getBody()->getContents(); dd($items); $id = 1234567 There are more than 1000+ words in this line and I need to find the given value $id I tried to search through whereLike, but it didn’t work out, due to the… Read More How to find a given value in a string Laravel

How to show fully the error and remove the truncated?

I am using GuzzleHttp to send post request to another project. But when I have error I can’t see all error it is always truncated. Can anyone know how to remove the (truncated…) so that I can fully see the error? GuzzleHttp\Exception\ServerException Server error: POST http://127.0.0.1:8000/api/api resulted in a 500 Internal Server Error response: <!doctype… Read More How to show fully the error and remove the truncated?

How to call API in laravel which include the OAuth key and secret

I want to call external API from laravel HttpClient. I’m not understanding how to pass the following authorization keys of OAuth 1.0. 1. Signature Method 2. Consumer Key 3. Consumer Secret 4. Access Token 5. Token Secret 6. Version 7. Realm is this the right way? $response = Http::withHeaders([ ‘Signature Method’ => ‘Signature Method’, ‘Consumer… Read More How to call API in laravel which include the OAuth key and secret