Zend framework Zend_Uri_Http:使用Google图表Uri时提供的Uri无效?

Zend framework Zend_Uri_Http:使用Google图表Uri时提供的Uri无效?,zend-framework,google-visualization,zend-http-client,Zend Framework,Google Visualization,Zend Http Client,我的应用程序使用谷歌图表和HTTPS。我需要将谷歌图表显示为“安全”图像,否则Internet Explorer会抱怨显示不安全的内容。因此,我试图使用Zend_Http_客户端请求下载它们(然后链接到本地文件),但我似乎做不到 URI应该有效,因为我可以单击此链接并查看图像: 以下是我正在使用的代码: $chartUrl = 'http://chart.apis.google.com/chart?chs=250x150&cht=bvg&chds=0,19&chd=t:

我的应用程序使用谷歌图表和HTTPS。我需要将谷歌图表显示为“安全”图像,否则Internet Explorer会抱怨显示不安全的内容。因此,我试图使用
Zend_Http_客户端
请求下载它们(然后链接到本地文件),但我似乎做不到

URI应该有效,因为我可以单击此链接并查看图像:

以下是我正在使用的代码:

$chartUrl = 'http://chart.apis.google.com/chart?chs=250x150&cht=bvg&chds=0,19&chd=t:19&chxt=x,y&chxl=0:|2009&chxr=1,0,19&chf=bg,s,F2F0E1';
$client = new Zend_Http_Client($chartUrl, array('maxredirects' => 0, 'timeout' => 30));
$response = $client->request();
我做错了什么?我还有别的方法可以做到这一点吗

变通 由于Google图表URI使用“无效”字符,因此在构造
Zend_URI
时验证失败。这就是我下载谷歌图表所必须做的

/**
 * Returns the URL of the Google chart image that has been downloaded and stored locally. If it has not been downloaded yet, it will be download.
 * @param string $chartUrl
 * @return string
 */
protected function _getLocalImageUrl($chartUrl)
{
    $savePath = realpath(APPLICATION_PATH . '/../public/Resources/google-charts/');
    $hashedChartUrl = md5($chartUrl);
    $localPath = "$savePath/$hashedChartUrl";
    
    if (!file_exists($localPath)) {
        exec("wget -O \"$localPath\" \"$chartUrl\"");
    }
    
    return "/Resources/google-charts/$hashedChartUrl";
}

试试看:
$chartUrl=http://chart.apis.google.com/chart?chs=250x150&cht=bvg&chds=0,19&chd=t%3A19&chxt=x,y&chxl=0%3A | 2009&chxr=1,0,19&chf=bg,s,F2F0E1'

[编辑]
如评论中所述,urlencode没有解决问题,但用十六进制值替换冒号解决了问题。

问题在于Google图表URL包含通常无效的字符(例如冒号字符),因此验证失败。您是否尝试过用十六进制值替换这些字符?(即:“:”变为“%3A”)。您可以通过查看asciitable.com来检查每个字符应该是什么。我认为%3A起作用了。将您的答案更改为“用%3A替换冒号”,我将接受您的答案