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