0
我有一個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
提前感謝有人幫助!
您的代碼看起來正確。您是否嘗試過直接加載asp頁面以查看內容是否存在? – 2010-05-03 11:37:53
直接調用asp頁面可以正常工作。 無論如何,項目經理已經改變了幾分鐘前的指定-.-「 我會在嘗試使用新規格後更新問題。 – theCrius 2010-05-03 12:55:56