如何使用PhP获取外部ASP文件的动态生成内容?

时间:2010-05-03 11:24:48

标签: php authentication asp-classic content-management

情况就是这样:

我有一个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

提前感谢任何人都会帮忙!

1 个答案:

答案 0 :(得分:0)

我猜您使用浏览器登录了该站点,但未使用PHP脚本登录。