chart.apis.google.com返回错误400

时间:2015-08-19 14:46:45

标签: http get google-visualization

昨天我用namebench运行了大量的DNS测试,因为我当前的DNS服务器给了我很多问题。问题是所有生成的Google图表都无法加载。但这从来没有发生在我身上。我查看了namebench返回的HTML页面的源代码,并打开了图形的链接,然后返回HTTP错误400.

一个示例网址:

http://chart.apis.google.com/chart?chxt=y%2Cx%2Cx&chd=e%3AEmE8FXFeFfFqFwFxFxFzF9GEGGGKGLGOGQGRGSGSGTGWGYGcGdGdGdGeGhGiGjGlGqGqGqGqGvGwGxGxG0G0G0G1G2G4G5G7G9G-G-HAHAHEHGHKHLHMHMHNHPHRHWHWHYHYHZHaHeHiHiHjHkHkHlHmHnHnHoHoHpHqHsHtHtHuHwHxHyHzHzH0H1H2H2H7H9H9H-H-H.H.IAIAIBIBICIDIEIGIHILINININIOIQIRIRISIWIWIZIaIdIdIhIiIiIlImInIoIqIqIsIsIwIyIyIzI0I0I4I4I8I9I.JBJBJBJCJCJCJCJGJGJHJJJKJMJPJRJSJUJUJXJXJYJYJZJaJbJdJdJeJfJgJgJnJoJpJpJpJqJsJsJtJuJvJvJxJzJ3J7J-J-J.KAKAKBKCKCKDKEKFKFKGKIKLKMKMKOKPKQKQKRKSKSKSKTKUKVKWKXKaKaKcKjKjKmKrKsKtKuKxKzKzK2K3K3K4K4K5K6K7LALALBLBLELFLGLHLILILMLOLPLRLVLVLaLaLdLeLjLpLpLrLsLvLxLzLzL1L4L4L6L6L8L-MBMBMBMCMGMHMIMJMJMLMUMWMaMcMcMcMgMiMiMmMoMqMvMyM2M2M5M7M8M8M-M.NANMNZNdNoNqNrN0N2OFOGOPOWOcOiOqO6O7PBPDPRPSPhPvPxQeQrQsRQRtSOSUSgTBTVTkUKU9VIWQYWY0ZRZsaNbPbYcEc8dkftmvpTtEuZ4d.7&chxp=0%7C2%2C1155&chxr=1%2C0%2C2570%7C2%2C-128.5%2C2698.5&chxtc=1%2C-720&chco=0000ff&chbh=a&chs=720x415&cht=bhg&chxl=0%3A%7CSuomi%204%20FI%7CDiveo%20MX%7CNetscalibur%20IT%7CTDA%20DZ%7CGlobecomm%20Systems%20A2%7C128.199.248.105%7C192.71.211.211%7CPokoeln%20DE%7C103.241.0.207%7CGaoland-2%20FR-2%7C41.185.78.25%7C103.25.56.238%7C84.200.83.161%7C163.47.20.30%7CFortressITX%20US%7C163.47.21.44%7C103.25.202.192%7CReynwood%20Comm%20US%7C151.236.20.236%7C295.ca-2%20CA-2%7C106.185.41.36%7CChristiania%20DK%7CGradwell-2%20GB%7C213.183.57.55%7Crdsar%20RO%7CIPLAN-2%20AR%7C192.71.218.218%7CTelefonica%20Centroamerica%20SV%7C192.71.247.247%7CAS520.net%20EU%7C178.17.170.67%7CFast%20GB%7CCETIC%20Algeria%20DZ%7COpole%20PL%7CGaoland-1%20FR%7CIsik%20Universitesi%20TR%7CBatelco-2%20JO%7CHamilton%20Hydro%20/%20FibreWired%20CA%7C88.82.109.9%7C31.220.5.106%7CMeganet%20US%7CnFrame-1%20US%7CRDSNet-2%20RO-2%7CGlobal%20Crossing%20snv%20US%7CDNS-Roots%20NYC%20US%7CUnifiedroot-2%20NL%7CCaucasus%20Online%20GE%7C217.78.6.191%7COceanic%20Cable%20US%7CFirmRadio%20UA%7CCodetel%20DO%7CUnifiedroot-1%20NL%7CRDS%20Pitesti%20RO%7CGlobalNet-2%20MT%7C8e6%20Technologies%20US%7CGibNet/Sapphire%20GI%7C151.236.29.92%7CUnifiedroot-6%20NL%7CGibnet/Sapphire-2%20GI%7CSunrise-3%20CH%7CCA-DNS/Verizon-2%20CA%7CVozTelecom%20ES%7CComput%20RU%7CInfoTelecom%20ES%7CSATCOM%20Systems%20A2%7Ceuroweb%20RO%7CInternap-2%20US%7C23.226.230.72%7CSloboda%20UA%7CPlant%20Telecom/InfoAve%204%20US%7CNeo%20ES%7C104.245.33.185%7CInFlow%20San%20Diego%20US%7CFrii-2%20US%7CDPN%20Duss%20DE%7CETB%20CO-3%7CMobtel%20Srbija%20SR%20RS%7C192.71.249.249%7C104.219.55.89%7C62.141.38.230%7CEUItalia%204%20IT%7CAmnet%20Honduras%20HN%7CEUItalia%203%20IT%7CStarnet%20MD%7CG-Tel%20Azteca%20MX%7CMkData%20SE%7CTtnet%2039%20TR%7CDiveo-2%20MX%7CRSSPNet%20RU%7CMiconet%20PL%7CNeterra%20BG%7CETB-2%20CO%7CMovistar-2%20ES%7Cbbsyd%20DK%7CTelusMobility%203%20CA%7CAll2Easy/Modesto%20US%7CHydro%20One%20CA%7C37.187.0.40%7CETB%20CO-2%7CTtnet%2040%20TR%7CADAM%20ES%7CUni-Ljubljana%20SI%7CPLD-2%20US%7C78.47.34.12%7CInfracom%20Network%20Application%20IT%7CCellNet%20BG%7CUltraVPN-2%20FR%7CMT-2%20MK%7CTelcel-1%20MX%7CAirbites%20Lviv-2%20UA%7CTelio-2%20NO%7CDTAG%20L%20DE%7CMaxcom%20MX%7C31.220.43.191%7CRadiant-2%20CA%7CIndigo%20IE%7CProfiber%20DK%7CETB%20CO%7CTelcel-2%20MX%7CBatelco-1%20JO%7C178.79.174.162%7CAPUA%20inet-2%20AG%7CBresnan-2%20US%7Clandsraad%20ES%7CaltoHiway-2%20GB%7CTNG-2%20DE%7CNavega-2%20GT%7CCable.net%20CO%7CUU%20EU%200702%20DE%7CZugernet%20CH%7CBHI-2%20US%7CCesnet%20CZ%7Cxtdnet%20NL%7CAmigo-2%20GT%7CDTAG%20H%20DE%7CBerlin%20CCC%20DE%7CEOL-2%20HU%7C108.61.210.58%7CUni%20Ulm%20DE%7CSWISP-2%20GB%7CWiBand%20CA%7CMindark%20SE%7CCyberus-3%20CA%7CAlharbitelecom%20GB%7CBright/Horizontel%20US%7CHurricane%20Electric%7CAvalonia%20DK%7C95.85.9.86%7CVTX%20Datacomm%20CH%7CUSB%20Skynet%20VE%7CByteCamp-2%20DE%7CMIPPS%20INC%20CA%7CKELCOM/Cybersurf-2%20CA%7CClearwire%20WAR%20US%7CKELCOM/Cybersurf%20CA%7CWIND-2%20IT%7CO2%20Ireland-2%20IE%7CNavega%20GT%7CSWISP%20GB%7CNTT%20EU%20GB%7C69.28.67.83%7CReflact%20DE%7CPLD%20US%7CNefarious%3F%20US%7CClara.net%20DE%7CBlueWin%20CH%7CDTAG-F%20DE%7CUU%20EU%200300%20FR%7CAvalonia-3%20DK%7CNumericable-2%20FR%7CGorgeNet-2%20US%7C104.245.39.112%7CWiTopia%20US%7CSprint%20PCS/brbnca-2%20US%7CTelefonica%20CentroAmerica%20GT%7CSATCOM%20Systems-2%20A2%7Cmtweb/transaria%20US%7CBT%20Alliance/INFONET%20US%7CBluewin%202%20CH%7CAEBC-4%20CA%7CInternap%20US%7CMonzoon%20ZRH-2%20CH%7CAvalonia-2%20DK%7CBluewin-4%20CH%7Calharbitelecom%20GB%7CBsoCom%20FR%7CSvenskaKyrkan%20SE%7COpalSolutions-3%20GB%7CCirque%20DK%7CUU%20EU%20206%7CIndigo%20IE-2%7CTital%20Internet%20GB%7CTime%20Warner%20TOSA-2%20US%7CPaeTec%20Ana-7%20US%7CSpeakeasy%20Seattle%20US%7CCSInet%20US%7CGreat%20Lakes%20Internet%20US%7CMultiband%20Corporation%20US%7CUU%20EU-3%20GB%7CColo4Dallas%20US%7CUU%20EU-201%20NL%7CHerakles%20Sacremento%20US%7CBestel-2%20MX%7CNetworkOnline%20US%7CUU%20EU%20400%7CUnited%20Online%20VGS%20US%7CSprint%20PCS%20Chi-2%20US%7CIntrinsec%20FR%7CEircom-2%20IE%7CTELUS%20Mobility-2%20CA%7CU.%20of%20British%20Columbia%20CA%7CUU%20EU%205a%20GB%7CCox-7%20US%7CRIO%20Networks%20US%7CAmigo%20GT%7CBHI%20US%7CFortalnet%20BR%7CSprint%20PCS%20brbncar12%20US%7CUUnet-EU4%20GB%7CUU%20EU%200703%20DE%7CAirband%20US%7CCityNet%203%20US%7CMonzoon%20CH%7CG-Tel%20Maya%20MX%7CGlobal%20Crossing%20Phoenix-2%20US%7CExceed%20Tech%20US%7CInternap%20Seattle-2%20US%7CInFlow%20ATL%20US%7CU%20of%20Houston-1%20US%7CTriad%20Telecom%20US%7CHorizon%20Cable%20Stinson-2%20US%7CPOBOX%20internet%20GB%7CCox-6%20US%7CO1%204%20US%7CVerizon%20Seattle%20US%7CDynGuide-2%7CPNAP-LON-2%20GB%7CSungard%20Inflow%20US%7CTELUS%20Mobility%20CA%7CACNUSA%7CEU%20BT%20AMS%20NL%7CGigaDNS%20BR%7CNeonova%20Network%20Services%20US%7CVerizon%20Dial-Up%20TX%20US%7CCA-DNS/Verizon%20CA%7CSYS-127.0.0.1%7CGEUS%7CExeculink%20CA%7C295.ca%20CA-2%7CInternap%20Seattle%20US%7CCyberNet%20Comm%20US%7CInterap%20LAX-2%20US%7CHydro%20One-2%20CA%7CUmich%20ITD-2%20US%7CVT%20ISB%20US%7CPrimary%20US%7CU.%20of%20Texas%20at%20San%20Antonio%20US%7CCox%20Oklahoma%20City-2%20US%7CInternap%20LAX%20US%7CMSU%20ATS%20US%7CSpeedNet%20Michigan%20US%7CSprintlink%7CSpirit%20Telecom%20US%7CSprint%20PCS/ekrg-2%20US%7CAPI%20Digital%20US%7CTelwest%20US%7CU%20of%20Houston-2%20US%7CPaeTec%20Chicago%20CA%7CInternap%20SJE%20US%7CVerizon%20NC%20Opt-Out%20US%7CSogetel-2%20CA%7CPathway%20CA%7CInternap%20Denver%20US%7CCybersurf%20CA%7CSprint%20PCS%20Ft.%20Worth%20US%7CEasytel%203%20US%7CSprint%20PCS/atlng%20US%7CDistributel-2%20CA%7CExeculink%20CA-2%7CUU%20Cache-6%20US%7CCable%20%26%20Wireless%20DE-3%7CISP%20Alliance%2C%20INC%20US%7CDnet-3%20US%7CDSL%20Extreme-2%20US%7CInternap%20ACS%20US%7CSBC/AT%26T%20Global-2%20US%7CPNAP%20London%20GB%7CUOL%20BR%7CVerizionBusiness%20US%7CInternap%20Houston%20US%7CCox%20Oklahoma%20City%20US%7CDSL%20Extreme-5%20US%7CSprint%20PCS%20Ft.%20Worth-2%20US%7CMCI-3%20US%7CFlow%20Jamaica-4%20JM%7CSecureDesigns-2%20US%7CDynGuide%7CUnited%20Online%20DCA%20US%7CU.%20of%20Michigan%20US-2%7CWvfiber%20US%7CVerizon%20NY%20Opt-Out%20US%7CAPI%20Digital-2%20US%7CiPrimus%20NJ%203%20US%7CInternap%20CHI%20US%7CBright.net%20US%7CCable%20%26%20Wireless%20DE%7CNetStar%20US%7CTerra-2%20BR%7CYMAX%20US%7CAlma%20Telco-2%20US%7CDnet-4%20US%7CAlma%20Telco%20US%7CUU%20Dial%2060%20US%7CSBC%20Clobal%20TX-2%20US%7CVerizon%20Dallas%20US%7CUltraDNS-2%7CLevel%203/GTEI-2%7CComodo%20Secure%20DNS%7CRadiant%20Alberta%20CA%7CSpeedNet-2%20Michigan%20US%7CEarthlink%20Opt-Out%20US-2%7CUU%20Cache%20US%7CMetConnect-1%20US%7CEarthlink%20Opt-Out%20US%7CUU%20Cache-2%20US%7CQwest-2%20US%7CAccess%20Northeast%20US%7CIntap%20US%7CComodo%20Secure%20DNS-2%7CVideotron%20Phone-4%20CA%7CUU%20Cache-7%20US%7CVerizon%20Boston%20US%7CInternap%20WDC%20US%7CTDS%208%20US%7C1scom%20US%7CVerizon%20NC%20US%7CEarthlink%20Ms%20US%7CNTT-2%7CInternap%20CHG%20US%7CQwest%20Redirect%20US%7CUU%20Cache-5%20US%7CSBC/AT%26T%20Global%20US%7CCIMCO-2%20US%7CLevel3-R2%7CUU%20Cache-4%20US%7CNorton%20DNS-2%20US%7CUU%20Cache-3%20US%7CBullEye%20Telecom%20US%7CCIMCO%20US%7CQwest%20US%7CWtechlink/Pacinfo/AT%26T-2%20US%7CInternap%20CHG-2%20US%7CUU%20Cache-2%20US-2%7CInternap%20Boston%20US%7CInternap%20Philadelphia%20US%7CWtechlink/AT%26T-2%20US%7CInternap%20NYC-2%20US%7CLevel3-R1%7CRCN%20ATW-2%20US%7CCogent%20WDC%20US%7CVerizon%20Philadelphia%20US%7CLevel%203/GTEI-4%7CAT%26T%20ASM%20US%7CSBC%20San%20Diego%20US%7CAT%26T%20New%20Orleans%20US%7CInternap%20NYC%20US%7COpenDNS%7COpenDNS-3%7CGenuity%20BAK%7CGoogle%20Public%20DNS-2%7CGoogle%20Public%20DNS%7C1%3A%7C0%7C320%7C640%7C960%7C1280%7C1600%7C1920%7C2240%7C2560%7C2570%7C2%3A%7CDuration%20in%20ms.

我上传的整个HTML文件here

1 个答案:

答案 0 :(得分:1)

使用您的代码创建a fiddle

来自google developers image charts documentation

  

将您的图表指定为浏览器或标记中的URL   叫做GET请求。发出GET请求很简单,但GET URL是   限制为2K字符。如果您有更多数据怎么办?

     

幸运的是,Chart API支持最高16K的图表请求的HTTP POST   长。权衡是使用POST的复杂性。

第一个解决方案变为使用POST。该链接还包含使用表单元素,javascript或php的POST示例。

The URL length limitation -

  

网址的最大长度不是由Google Chart API决定的,   而是通过Web浏览器和Web服务器考虑因素。最长的   Google在图表中接受的网址GET请求中包含2048个字符   URL编码后的长度(例如,|变为%7C)。对于POST,此限制   是16K。

第二个解决方案:相同的链接提供了下一种解决方案,实际上减少了网址长度:

  • 如果您使用text encoding data format,请从数字中删除前导零,删除小数点后的尾随零,并在小数点后舍入或截断数字。
  • 如果这不足以缩短网址,请使用simple(1个字符)或 extended(2个字符)编码。
  • 样本数据较少;即,减少粒度。
  • 删除装备和装饰品,例如colorslabelsstyles,来自您的图表。

第一个解决方案

这个适用于前两个图表,它们有大约8000个符合POST请求的字符(< 16000):

<h2>Mean Response Duration</h2>
<h3>Fastest Individual Response Duration</h3>

即。你必须通过所描述的方法之一编写POST。

第二种解决方案

这适用于在get上获得413(请求实体太大)状态的最后2个图表。最后2个字符大约有2万个字符,最后6个字符。

<h3>Response Distribution Chart (First 200ms)</h3>
<h3>Response Distribution Chart (Full)</h3> 

在这里,您确实需要通过建议的方法之一缩短网址。也就是说,短于16000。

出于测试目的,您可以使用此类表单和更改参数以满足您的需要。 Working fid

<form action='https://chart.googleapis.com/chart' method='POST' target="graph_target">
  <input type="hidden" name="cht" value="lc"  />
  <input type="hidden" name="chtt" value="This is | my chart"  />
  <input type='hidden' name='chs' value='600x200' />
  <input type="hidden" name="chxt" value="x,y" />
  <input type='hidden' name='chd' value='t:40,20,50,20,100'/>
  <input type="submit"  />
</form>
<iframe name='graph_target' src='' style='width:600px;height:200px;'></iframe>
<script type="text/javascript">
document.forms["graphform"].submit();
</script>