2011-12-29 19 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