Thursday, February 22, 2018

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

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

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 GuzzleHttpClient; 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 GuzzleHttpClient();

$disrequest = $client->get('https://maps.googleapis.com/maps/api/distancematrix/json?origins='.$pickupaddress.'&destinations='.$deliveryaddress.'&mode=driving&key=ASESdsfsdfsdfdsfdf')->getBody();

$disjsondecode = json_decode($disrequest);
$tripdistance = $disjsondecode->rows[0]->elements[0]->distance->text;



from Laravel Questions and Answers https://laravelquestions.com/laravel/curl-error-7-failed-to-connect-to-maps-googleapis-com-port-443/
via Lzo Media

No comments:

Post a Comment