我正在使用以下代码来抓住挑战
preg_match("/'03AHJ(.*?)'/", $recaptcha_page_response,$captchastring);
在以下文字
var RecaptchaState = {
challenge : '03AHJ_VuvTTaeouhgwbBXLQxnyRpYagVrS5lfF2N90aSRWHio3pAyqd6lfnHnWb_cveXafWHcgtK5zmhpetpy2NAWxfoDlCXuub3v2GUaA7EZDn0VqA6CheWWiF8yFBM3i7zN0XtKzHKItsxfcArzgmH4ARft-OWzSrOGpAM_oG0hp12cZMgWmV15FwCNCtFuypkxnPhDv8Fagw4YDInvxal8nhxIJEen6M4iBJx4KGCjolyqImbzJ54I7jFZaS9OMlK-Giv3cOq7aHUTGJeG9f9joya4WkXXKsg',
timeout : 1800,
lang : 'en',
server : 'http://www.google.com/recaptcha/api/',
site : '6LeC3O0SAAAAAC_YcSZKQChES7yidMTP_h-6uTTX',
error_message : '',
programming_error : '',
然而它也返回'in array [0],这样就变成了
$captchastring = "http://www.google.com/recaptcha/api/image?c=$captchastring[0]";
此
http://www.google.com/recaptcha/api/image?c='03AHJ_VutYynsKzGrLzB3czHAOTgfl2jGc-r0S5fVXz9oELZQN-CbgtFqbZO0m-ZyfrcxDxw9NOWVvCZ2hsZqBY-fBNgCzW4Q1zgmLOMxgugVLYLc49GODWISsde0uKz904r-5qDC9VybX6AsmrUfAOnrgCfyKZUmGWkVtG1Zgjy5N-dQjldW_XOeWr94FlxKic-yG_9ca34fJnLZ06ol2FsYq9DeTZqsAYQ'
这显然是错误的,正则表达式会在''
之间获得所有内容,但不包括它们在返回的数组中?
答案 0 :(得分:0)
preg_match("/(?<=')03AHJ[^']*/", $recaptcha_page_response,$captchastring);