代码之家  ›  专栏  ›  技术社区  ›  Claudio

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

  •  0
  • Claudio  · 技术社区  · 15 年前

    情况是这样的:

    我有一个PhP登录页面,check是一个外部ASP页面生成的东西(昵称)。

    例如: 我被记录了?因此,直接打开asp页面将显示“昵称:thecruis”等。 我没有记录?所以打开ASP页面不会显示任何内容。

    现在我要用PhP页面捕捉“thecruis”字符串。 使用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 回复  |  直到 13 年前
        1
  •  0
  •   o0'.    15 年前

    我猜你是用浏览器登录的,但你没有用PHP脚本登录。