Google二维码生成API无法使用,寻求故障排查建议
Hey, sorry to hear that Google's old QR code API stopped working for you—let's break down what's going on here.
First off, that API has been long deprecated and fully discontinued by Google. The Google Chart API (including its QR code generation endpoint at http://chart.apis.google.com/chart) was officially marked as deprecated way back in 2012, and Google has been winding down all remaining support for it over the years. It's likely that the last legacy server instances handling these requests finally went offline or stopped responding reliably for your use case today.
Since this API is no longer maintained, you'll need to switch to an alternative solution. Here are some practical, reliable options:
- Local/language-specific libraries: Generate QR codes directly in your codebase using open-source libraries. For example:
- JavaScript: Use
QRCode.jsto render QR codes client-side - Python: The
qrcodepackage lets you generate codes as images - Java/C#: The ZXing library has robust QR code generation support
- JavaScript: Use
- Self-hosted services: If you need a dedicated API, set up your own lightweight service using open-source tools like go-qrcode (for Go) or other server-side libraries
- Modern third-party APIs: Opt for actively maintained QR code APIs (just be sure to choose one with clear uptime guarantees and terms of service that fit your needs)
Looking at your old API URL: http://chart.apis.google.com/chart?cht=qr&chs=230x230&chof=gif&&chl=100IP020180086500010001&choe=UTF-8&
You have a double ampersand (&&) between chof=gif and chl=...—while this was probably ignored by the old API, it's a minor syntax quirk to watch out for when building new requests. That said, this wasn't the cause of the current failure—the main issue is the discontinued endpoint.
内容的提问来源于stack exchange,提问作者shiji

