Hi,

I would like to share an issue to a bug I met this morning. I have downloaded the Mobile codes module for the first time. So I didn't know how to configure it.

The aim is to display a qr-code for a link.

So I've downloaded Link module as well, because I encontered a display bug ("Error" message) with a text field.

I've set a link field and a Mobile code display (preset=small). Mobile code configuration : default (then Google is choosed).

The same message appeared when displaying the field contant in the node.

Then I configured small preset with "php-qrcode" but the same message appeared.

So I tried google api out of drupal by the link http://goo.gl/. And I've discovered that the url used by Mobile codes was non longer the same as th link used by Google qrdresscode.

So, in mobile_codes.inc file, I've replaced
$provider->url = 'https://chart.googleapis.com/chart?chs=[width]x[height]&cht=qr&chl=[data...';
by
$provider->url = 'http://chart.googleapis.com/chart?cht=qr&chs=[width]x[height]&choe=[outp...';

I did the same in the help.inc file.

And it works well now. Is this issue acceptable ?

Comments

ryan.davis’s picture

Status: Active » Closed (works as designed)

Hello!

I was unable to replicate this issue. This does not seem like it would be an issue with the way the Google API is called within the module. A good way to test this sort of issue is to build an example call using the format you find and try visiting it in your browser:

https://chart.googleapis.com/chart?chs=200x200&cht=qr&chl=yaydrupal&choe...

Reviewing the changes made to $provider->url, I see two things have changed:

* The arguments are in a different order
* You have switched from HTTP to HTTPS

The order of the arguments should not change the response from Google, and this can be tested by creating another example call with the arguments mixed around:

https://chart.googleapis.com/chart?cht=qr&choe=utf8&chl=yaydrupal&chs=20...

I think the reason it started working for you was related to the change from HTTPS to HTTP. Google will accept either, so the issue would be found with your site, specifically your hosting environment. When you were experiencing this issue, did you find an error in your PHP logs complaining that PHP could not open a secure socket? Some hosting providers do not have that functionality available with their PHP installation, and some require that you request it specifically. If that was the issue, it will most likely pop up again later on as you use other modules which incorporate external API calls into their code.

Thanks for providing so much information about the issue, as well as details to how you reviewed the problem yourself. The only other thing you might want to add in the future is an example of the error you are receiving, or even better a word for word copy of the error itself.