在我的页面中显示验证码图像

时间:2022-02-08 22:16:25

i have to get the captcha image from a web page. for that i use phpquery and dom file like the following..

我必须从网页上获取验证码图像。因为我使用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";
    }
?>

now, i have only the problem that it fetch the source, but cant get the image. is that impossible to save the captcha image in my page ?

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

1 个解决方案

#1


0  

Change img sourse like this

像这样改变img

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

#1


0  

Change img sourse like this

像这样改变img

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