guzzlehttp

cURL error 7: Failed to connect to maps.googleapis.com port 443

我们两清 提交于 2019-12-11 14:42:20
问题 I got following Error when get Distance between two places in Laravel. i use guzzlehttp/guzzle package to get Google Map api response. i previously declare use GuzzleHttp\Client; How to solve this Issue. Error : cURL error 7: Failed to connect to maps.googleapis.com port 443: Network is unreachable (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) $pickupaddress = urlencode($frmplace); $deliveryaddress = urlencode($destplace); $client = new GuzzleHttp\Client(); $disrequest = $client-

Guzzle - Laravel. How to make request with x-www-form-url-encoded

坚强是说给别人听的谎言 提交于 2019-12-06 03:49:50
问题 I need to integrate an API so I write function: public function test() { $client = new GuzzleHttp\Client(); try { $res = $client->post('http://example.co.uk/auth/token', [ 'headers' => [ 'Content-Type' => 'application/x-www-form-urlencoded', ], 'json' => [ 'cliend_id' => 'SOMEID', 'client_secret' => '9999jjjj67Y0LBLq8CbftgfdreehYEI=', 'grant_type' => 'client_credentials' ] ]); $res = json_decode($res->getBody()->getContents(), true); dd($res); } catch (GuzzleHttp\Exception\ClientException $e)

Laravel Class 'App\\Http\\Controllers\\GuzzleHttp\\Client' not found

时光总嘲笑我的痴心妄想 提交于 2019-12-04 12:37:05
I've installed the client and I did an update using composer dump autoload but I still end up with the same error. After installing via composer require guzzlehttp/guzzle:~6.0 in the projects directory. $client = new GuzzleHttp\Client(); Why isn' it working and why is it even referencing the wrong directory? You're going to want to get acquainted with PHP namespaces . Most files in Laravel are namespaced. Calls to functions within a namespace start within that namespace, with two exceptions: If you start the class name with a \ , that tells PHP to start at the root-level namespace: $client =