guzzle

guzzle client throws exception in laravel

元气小坏坏 提交于 2021-02-17 05:29:07
问题 I am trying to make a http post request in laravel as below $client = new Client(['debug'=>true,'exceptions'=>false]); $res = $client->request('POST', 'http://www.myservice.com/find_provider.php', [ 'form_params' => [ 'street'=> 'test', 'apt'=> '', 'zip'=> 'test', 'phone'=> 'test', ] ]); It return empty response. On debugging ,following exception is occurring curl_setopt_array(): cannot represent a stream of type Output as a STDIO FILE* I am using latest version of guzzle. Any idea how to

How to get and display an image from a guzzle request

╄→гoц情女王★ 提交于 2021-02-16 18:53:06
问题 I am trying to display an image from a guzzle request, everything worked fine but I am failing to display the image. This is the result I get, when trying to get users' data object(GuzzleHttp\Psr7\Response)#427 (6) { ["reasonPhrase":"GuzzleHttp\Psr7\Response":private]=> string(2) "OK" ["statusCode":"GuzzleHttp\Psr7\Response":private]=> int(200) ["headers":"GuzzleHttp\Psr7\Response":private]=> array(14) { ["Server"]=> array(1) { [0]=> string(6) "Cowboy" } ["Connection"]=> array(1) { [0]=>

How to upload files on Yammer API via the Azure Upload Small File API

眉间皱痕 提交于 2021-02-15 07:13:18
问题 How to upload an attachment along with a Yammer message? Any legacy method through attachment1 etc. fields of the /messages.json endpoint won't work anymore. The new method is not so well documented: https://developer.yammer.com/docs/upload-files-into-yammer-groups I'm giving here an example in PHP below, but you can do the same in any language. 回答1: You have to do it in two part First upload the picture to https://filesng.yammer.com/v4/uploadSmallFile and get the picture's id. Send your

Upload image to external webservice/API using Lumen/Laravel and Guzzle 6

狂风中的少年 提交于 2021-02-11 16:35:55
问题 I want to upload an image to a webservice using Lumen + Guzzle 6. The external web service does not accept "base64-encoding" the image to be sent. Only the image file is accepted as such. But I still get an error message from the external webservice/API that the image could not be found or it rather seems to be that Guzzle sent the request without the image. The check with file_exists($filename_with_path) responded successfully, therefore access to the file is generally possible. If I work

Upload image to external webservice/API using Lumen/Laravel and Guzzle 6

萝らか妹 提交于 2021-02-11 16:35:00
问题 I want to upload an image to a webservice using Lumen + Guzzle 6. The external web service does not accept "base64-encoding" the image to be sent. Only the image file is accepted as such. But I still get an error message from the external webservice/API that the image could not be found or it rather seems to be that Guzzle sent the request without the image. The check with file_exists($filename_with_path) responded successfully, therefore access to the file is generally possible. If I work

How to send image from Laravel controller to API Rest [closed]

﹥>﹥吖頭↗ 提交于 2021-02-10 06:59:43
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 13 days ago . Improve this question I need to take an image from storage in Laravel and send it from a Controller to an external API REST. I am using guzzlehttp multipart but the API didn't receive the file, returns file = null 回答1: This is how I did it a few days ago (taking file from Request): For single file:

guzzle concurrent request, wait for finished batch before sending next

主宰稳场 提交于 2021-02-08 10:17:41
问题 I thought this following code would work this way: a batch in the number of CONCURRENT_REQUESTS is send it is waited until all of these requests are finished the next batch of the above number is send and so on but in reality if I comment line 14 [ usleep(...) ] it seems the request batches are send as fast as possible generating thousands of queries to the server. Is it possible to change it? How do I change this behavior? <?php $pool = $this->getPool(); if (false !== $pool) { $pool->promise

Laravel 5.6 Passport oAuth2 can't make request with Guzzle

断了今生、忘了曾经 提交于 2021-02-08 07:49:08
问题 I have a fresh project on Laravel 5.6, where I'm trying to study and understand API Auth with Passport. I'm trying to do that, and after that to make a Javascript application from where I'll access that API. So, API for first-party applications. I've installed and registered all routes and setup specific to passport, and also installed Guzzle . I looked for some tutorials and now I'm with that code : RegisterController.php <?php namespace App\Http\Controllers\Api\Auth; use App\Http

Laravel 5.6 Passport oAuth2 can't make request with Guzzle

亡梦爱人 提交于 2021-02-08 07:47:41
问题 I have a fresh project on Laravel 5.6, where I'm trying to study and understand API Auth with Passport. I'm trying to do that, and after that to make a Javascript application from where I'll access that API. So, API for first-party applications. I've installed and registered all routes and setup specific to passport, and also installed Guzzle . I looked for some tutorials and now I'm with that code : RegisterController.php <?php namespace App\Http\Controllers\Api\Auth; use App\Http

Guzzle HTTP - add Authorization header directly into request

孤街浪徒 提交于 2021-02-06 14:43:48
问题 Can anyone explain how to add the Authorization Header within Guzzle? I can see the code below works for adding the username & password but in my instance I just want to add the Authorization header itself $client->request('GET', '/get', ['auth' => ['username', 'password'] The Basic Authorization header I want to add to my GET request :- Basic aGdkZQ1vOjBmNmFmYzdhMjhiMjcwZmE4YjEwOTQwMjc2NGQ3NDgxM2JhMjJkZjZlM2JlMzU5MTVlNGRkMTVlMGJlMWFiYmI= 回答1: From the looks of things, you are attempting to