guzzle

Testing Laravel route that listens for a webhook

耗尽温柔 提交于 2019-12-10 15:47:44
问题 Seems like I am missing something here, but I am struggling to implement a test for Laravel that integrates a SendOwl webhook. Here is the doc I am using: https://help.sendowl.com/help/using-web-hooks Note I have already added the route to exclude in VerifyCSRFToken Using ngrok (setting the webhook to go to the ngrok url for local dev) I have confirmed that the controller code is working correctly manually, and the webhook works. What I am stuck on is how to actually implement a test that can

guzzle ver 6 post method is not woking

≯℡__Kan透↙ 提交于 2019-12-10 15:24:11
问题 is working in postman (raw format data with with application/json type) with guzzle6 url-http://vm.xxxxx.com/v1/hirejob/ { "company_name":" company_name", "last_date_apply":"06/12/2015", "rid":"89498" } so am getting response 201 created but in guzzle $client = new Client(); $data = array(); $data['company_name'] = "company_name"; $data['last_date_apply'] = "06/12/2015"; $data['rid'] = "89498"; $url='http://vm.xxxxx.com/v1/hirejob/'; $data=json_encode($data); try { $request = $client->post(

How to match a result to a request when sending multiple requests?

人走茶凉 提交于 2019-12-10 15:18:04
问题 A. Summary As its title, Guzzle allows to send multiple requests at once to save time, as in documentation. $responses = $client->send(array( $requestObj1, $requestObj2, ... )); (given that each request object is an instance of Guzzle\Http\Message\EntityEnclosingRequestInterface) When responses come back, to identify which response is for which request, we can loop through each request and get the response (only available after executing the above command): $response1 = $requestObj1-

Prestashop 1.6, conflict: 2 different modules requiring same class, different versions

左心房为你撑大大i 提交于 2019-12-10 14:25:05
问题 In my Prestashop project, I have several modules. In one of them (let's call it "AWS") I installed AWS SDK using composer (in PHPStorm), as explained here. Composer has "required", among other libraries, "guzzlehttp", updated to its final version. On the other hand, there is another module (let's call it "orangeConnect" ) with composer too, that has an earlier version of "guzzlehttp". The problem lies when I am using AWS SDK in php, inside a php script in the first module. What happens is

How to return Guzzle JSON response

 ̄綄美尐妖づ 提交于 2019-12-10 13:49:19
问题 I am using Guzzle to make a aSync request that returns JSON. The call is working fine and the response is ok, however: $client = new Client(); $promise = $client->requestAsync($requestType ,$this->url.$resource, // endpoint [ 'auth' => [ // credentials $this->username, $this->password ], 'json' => $payload, // the package 'curl' => [ // some curl options CURLOPT_HTTPAUTH => CURLAUTH_BASIC, CURLOPT_RETURNTRANSFER => true, ], 'headers' => [ // custom headers 'Accept' => 'application/json',

Passing client certificates through Curl request using Guzzle

荒凉一梦 提交于 2019-12-09 15:54:08
问题 I have the following curl command sudo curl -E openyes.crt.pem --key openyes.key.pem https://sky.myapitutorial.in:444/app/live/get which works fine. But when I am trying to do from Guzzle, its failing. I am unable to pass the client certificates in the request. This is what I tried $headers = ['Content-Type' => 'application/json','X-Client-Id' => config('mykey') , 'X-Client-Secret' => config('mykey')]; $client = new client(); try { $response = $client->post( $endpoint , ['json' => $content,

Making requests to Google API using Guzzle and Socialite in Laravel 5

独自空忆成欢 提交于 2019-12-09 13:38:13
问题 I'm building a web app that has to interact with Google Contacts API and retrieve the Contact List of the authenticated user, but I'm getting ClientException in RequestException.php line 89: Client error response [url] https://www.google.com/m8/feeds/contacts/ambermphatic@gmail.com/full?prettyPrint=false [status code] 403 [reason phrase] Forbidden Here's my AuthenticateUser.php where I have included the getContactList function, I'm trying to make the Guzzle Request to the Google Server and

Firestore REST API: Query parameters type of object

不想你离开。 提交于 2019-12-08 19:32:19
问题 I am looking for an advice regarding Google Firestore REST API I am trying to update the document but keep the data that are not updated (https://cloud.google.com/firestore/docs/reference/rest/v1beta1/projects.databases.documents/patch) I have a document in "message" collection, the document contains following fields: "timestamp", "message" and "user". If I do the PATCH request to update the "message" field, then the "timestamp" and "user" fields are removed. There is "Query Parameter"

Converting this cURL for Guzzle

眉间皱痕 提交于 2019-12-08 16:37:36
问题 I've tried reading through the Guzzle docs but I can't wrap my head around this problem. I want to use Guzzle instead of cURL for the following: protected $url = 'https://secure.abcdef.com/cgi/xml_request_server.php'; $xml = "<ABCRequest>\n"; $xml .= "<Authentication>\n"; $xml .= "<ABLogin>$this->gwlogin</ABLogin>\n"; $xml .= "<ABKey>$this->gwkey</ABKey>\n"; $xml .= "</Authentication>\n"; $xml .= "<Request>\n"; $xml .= "<RequestType>SearchABC</RequestType>\n"; $xml .= "</Request>\n"; $xml .=

Guzzle 6 - Get request total time

天涯浪子 提交于 2019-12-08 16:27:41
问题 I'm searching to retrieve the request total time in Guzzle 6, just after a simple GET request : $client = new GuzzleHttp\Client(); $response = client->get('http://www.google.com/'); But can't find anything in the docs about that. Any idea ? Thanks a lot. 回答1: In Guzzle 6.1.0 You can use the 'on_stats' request option to get transfer time etc. More information can be found at Request Options - on_stats https://github.com/guzzle/guzzle/releases/tag/6.1.0 回答2: $client = new GuzzleHttp\Client();