2011-12-29 20 views
0

我打算建立一个接口,通过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

您是否试图获取目标网站的HTML内容?如果是这样,尝试file_get_contents()

echo file_get_contents("http://urlOfWebsite.com"); 

从您可以在函数的输出保存到一个变量,并解析HTML得到你想要的元素。

文档:http://php.net/manual/en/function.file-get-contents.php

+0

我已经使用和尝试file_get_content()。但验证码图像不能获取。 – user1120482 2011-12-29 05:24:49

+0

@ user1120482会发生什么,可以防止你得到它? – 2011-12-29 05:31:47

+0

我必须从页面中获取内容(验证码图片)。 – user1120482 2011-12-29 05:31:49