get_file_contents('http://xxx.com/1.php');
会获得这个url地址返回的全部html代码,你想取里面某一个字符串,得自己写程序来实现。或者用正则,或者用字符串函数来进行匹配。鉴于html的无规则性,难度要比xml大的多。最好的做法是用html dom,比如00在<a></a>这个标记内,就用html dom来取这个节点的数据。
碰到一点规则都没有的html文档,真是一点脾气都没有。

解决方案 »

  1.   

    <?php
    // get contents of a file into a string
    $filename = "http://xxx.com/1.php";
    $handle = fopen($filename, "r");
    $contents = fread($handle, 10);
    fclose($handle); 
    echo $contents;?> 还是我自己想出实际的方法,发这里给其他人,大家可以借鉴一下
      

  2.   

    file_get_contents -- 将整个文件读入一个字符串
    string file_get_contents ( string filename [, bool use_include_path [, resource context [, int offset [, int maxlen]]]] )
    无语一下```这么容易的东西你还要分开来弄<?php
    $filename = "http://xxx.com/1.php";
    $stringsssss = file_get_contents($filename );
    echo $stringsssss;
    ?>
      

  3.   

    请问,服务器php.ini中的fopen函数没给你开放,如何做?