我将构建一个接口,通过phpquery从另一个网页获取数据。但是有验证码图像,我无法获取验证码图像。
我也不能打印phpquery的输出
这是重定向图像的代码
phpQuery::$debug = true;
$result = phpQuery::newDocumentFile($url);
echo $result;
foreach(pq('.whoContentTable') as $tag) {
foreach(pq($tag)->find('div.LBD_CaptchaImage') as $td) {
print $td;
代码的输出:
Found: div.podContent, comparing with matchClasses()
Found: div.LBD_CaptchaDiv, comparing with matchClasses()
Found: div.LBD_CaptchaImage, comparing with matchClasses()
Found: div.LBD_CaptchaIcons, comparing with matchClasses()
Found: div#whoisverify_ctl00_cphcontent_ctlcaptcha_SoundPlaceholder.LBD_placeholder, comparing with matchClasses()
Found: input#ctl00_cphContent_btnVerifyCode.btnVerifyCode.WhoisMainSprite[name="ctl00$cphContent$btnVerifyCode"], comparing with matchClasses()
如何从页面获取输出内容?
答案 0 :(得分:0)
您是否尝试获取目标网站的HTML内容?如果是,请尝试file_get_contents()
:
echo file_get_contents("http://urlOfWebsite.com");
由此可以将函数的输出保存到变量并解析HTML以获取所需的元素。