Google PHP API library example: user-example: Firefox can't establish a connection to the server at localhost

182 Views Asked by At

Running Windows 7 Ultimate / Apache 2.4.9 / PHP 5.5.11 / FireFox 29.

When I try running the Google PHP API example user-example (using FireFox) I am able to connect and receive the approval page for the URL Shortener. However, when I click on the Accept button I receive the message:

"Firefox can't establish a connection to the server at localhost"

netstat showed that only Apache was listening on port 80. So, thinking that this might be a call-back issue, I ran a REST script (using the same credentials) that did pretty much the same thing, i.e. queried OAuth etc. This worked successfully.

NB: IE11 fails at the same point with a "This page can’t be displayed" message, the offending URL being https://accounts.google.com.

Any assistance greatly appreciated.

2

There are 2 best solutions below

0
On BEST ANSWER

I finally resolved the issue, much to my chagrin.

With all the other URI's in the example being "https://" I inadvertently set the call-back's URI to

https://localhost/etc

The solution was to set the call-back's URI to an 'http', i.e.

http://localhost/etc

1
On

Not sure if this will help, and its to big for a comment but try this

Changing the following PHP.ini settings:

  1. Uncomment the extension=php_openssl.dll - necessary for 'https' URLs;
  2. Set the time-zone. Google is fussy about times, so this might have affected the outcome.