【问题标题】:display a captcha image in my page在我的页面中显示验证码图像
【发布时间】:2011-12-30 14:52:50
【问题描述】:

我必须从网页获取验证码图像。为此,我使用 phpquery 和 dom 文件,如下所示..

<?php
     include 'phpQuery-onefile.php';
      $html = file_get_contents("http://who.godaddy.com/whoisverify.aspx?domain=nettantra.com&prog_id=godaddy");
      $pq = phpQuery::newDocument($html);
     print $pq->find('img#whoisverify_ctl00_cphcontent_ctlcaptcha_CaptchaImage')->attr('src').'<br/>';
?>
<img src="<?php print $pq->find('img#whoisverify_ctl00_cphcontent_ctlcaptcha_CaptchaImage')->attr('src'); ?>" alt="captcha_image" />
<?php
    echo '<br />';
    require_once('../simple_html_dom.php');
    $html = file_get_html('http://who.godaddy.com/whoisverify.aspx?domain=nettantra.com&prog_id=godaddy');
    foreach($html->find('img') as $element) {
        echo $element.'<br/>';
    //    echo $element->src, "\n";
    }
?>

现在,我只有它获取源的问题,但无法获取图像。验证码图片无法保存在我的页面中吗?

【问题讨论】:

    标签: php captcha


    【解决方案1】:

    像这样更改 img 源

    <img src="http://who.godaddy.com/<?php print $pq->find('img#whoisverify_ctl00_cphcontent_ctlcaptcha_CaptchaImage')->attr('src'); ?>" alt="captcha_image" />
    

    【讨论】:

      猜你喜欢
      • 2017-11-11
      • 2014-07-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-27
      • 1970-01-01
      • 2017-08-11
      相关资源
      最近更新 更多