Reputation: 526
I am using MAMP as my local host and PHP 7.3.8 as my localhost.
On my site I am trying to connect to google maps as follows:
$url = "https://maps.googleapis.com/maps/api/distancematrix/json?origins=$postcode1&destinations=$postcode2&mode=driving&language=en-EN&sensor=false&key=MY-API-KEY"
$data = @file_get_content($url)
However for some reason the connection is not established when I try this on a live site (using GoDaddy as a server) all is well and I get the wanted result.
I have tried to switch on allow_url_fopen
in the php.ini and have checked the firewall on my localhost and made sure the ports are open, however no joy.
Anyhelp to solve this problem welcome
Upvotes: 0
Views: 50