2016-02-11 101 views
5

當驗證碼使得調用https://www.google.com/recaptcha/api2/userverify?k=驗證碼將失效JSON從呼叫https://www.google.com/recaptcha/api2/userverify

這又回到這個

)]}」 [「uvresp」,,,, 2]

授予一個有效的k它回來了多一點。但是)]}'顯然是無效的json。 當我嘗試使用grecaptcha.getResponse()獲取響應時,我得到一個空字符串。

使用捲曲時結果相同。

任何幫助,將不勝感激。

+0

你能弄清楚如何使用這個API相同的子? –

回答

1

實際上,返回的值不是有效的json,而是由Google API解析得出的。

這是保護嗎?我不知道,但如果你看看在JavaScript中,你可以發現:

var jm=function(a,b,c,d,e,g,h,l,r){this.xl=a;this.$c=c||"GET";this.Ka=d;this.Gg=e||null;this.Td=m(h)?h:1;this.ye=0;this.xh=this.Nh=!1;this.uh=b;this.Mh=g;this.md=l||"";this.Zb=!!r;this.Wf=null};f=jm.prototype;f.getUrl=function(){return this.xl};f.ug=function(){return this.$c};f.Ca=function(){return this.Ka};f.fi=function(){return this.Zb};f.bi=function(){return this.md};var nm=function(){G.call(this);this.nj=new hm(0,mm,1,10,5E3);H(this,this.nj);this.ad=0};x(nm,G);var mm=new Nh;nm.prototype.send=function(a){return new Lc(function(b,c){var d=String(this.ad++);this.nj.send(d,a.Uf.toString(),a.ug(),a.Ca(),mm,void 0,u(function(a,d){var h=d.target;if(Xk(h)){var l=a.ml;h.B?(h=h.B.responseText,0==h.indexOf(")]}'\n")&&(h=h.substring(5)),h=Hg(h)):h=void 0;b(new l(h))}else c(new om(a))},this,a))},this)};var om=function(a){y.call(this);this.request=a};x(om,y); 

特別是看看:

var l=a.ml;h.B?(h=h.B.responseText,0==h.indexOf(")]}'\n")&&(h=h.substring(5)),h=Hg(h)):h=void 0;` 

解析器明確檢查值由)]}開始,剝去它。

我建議你只適用於「JSON」