簡體   English   中英

如何使用PhP獲取外部ASP文件的動態生成內容?

[英]How to get the dynamic generated content of an external ASP file using PhP?

這種情況:

我有一個PhP登錄頁面,該頁面檢查外部ASP頁是否已生成某些內容(昵稱)。

例如:我已登錄? 因此,直接打開asp頁面將顯示“昵稱:thecrius”,僅此而已。 我沒有登錄? 因此,打開ASP頁將不顯示任何內容。

現在,我必須在PhP頁面中捕獲“ thecrius”字符串。 使用file_get_contents僅返回“昵稱:”,即ASP頁面的“靜態”部分。

我做錯了什么?

一些代碼:

$aspSource = "http://www.example.com/inc/whois.asp"; //ASP external
$file = file_get_contents($aspSource); //get content of the asp page
$start = strpos($file, "username:") + 9; //cutting off the "nickname:"
$username = substr($file, $start); //get the username
echo "URL-> $aspSource<br>Content-> $file<br>Start-> $start<br>Username-> $username<br>END";

但是結果僅僅是

URL-> http://www.example.com/inc/whois.asp
Content-> username:
Start-> 9
Username->
END

在此先感謝任何人都會有所幫助!

我想您是使用瀏覽器登錄該站點的,但是您沒有使用PHP腳本登錄的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM