怎样调用 其他网站上面的一个页面,然后判断页面显示的内容?
看公司的代码,都是调用接口的,调用界面的怎么做?

解决方案 »

  1.   

    采集??iframe 引用??别人接口?就得沟通得到接口的文档了
      

  2.   

    把那个接口内容采集过来,自己再处理?
    file_get_contents
      

  3.   

    copy:
    file_get_contents
    (PHP 4 >= 4.3.0, PHP 5)file_get_contents -- 将整个文件读入一个字符串
    说明
    string file_get_contents ( string filename [, bool use_include_path [, resource context [, int offset [, int maxlen]]]] )和 file() 一样,只除了 file_get_contents() 把文件读入一个字符串。将在参数 offset 所指定的位置开始读取长度为 maxlen 的内容。如果失败,file_get_contents() 将返回 FALSE。file_get_contents() 函数是用来将文件的内容读入到一个字符串中的首选方法。如果操作系统支持还会使用内存映射技术来增强性能。注意: 如果要打开有特殊字符的 URL (比如说有空格),就需要使用 urlencode() 进行 URL 编码。注意: context 参数可以用 NULL 来忽略。更新日志版本 说明 
    5.0.0 添加了对 context 的支持。 
    5.1.0 添加了 offset 和 maxlen 参数。 注释
    注意: 本函数可安全用于二进制对象。
      

  4.   

    file_get_contents
    (PHP 4 >= 4.3.0, PHP 5)file_get_contents — 将整个文件读入一个字符串说明
    string file_get_contents ( string $filename [, bool $use_include_path [, resource $context [, int $offset [, int $maxlen ]]]] )
    和 file() 一样,只除了 file_get_contents() 把文件读入一个字符串。将在参数 offset 所指定的位置开始读取长度为 maxlen 的内容。如果失败,file_get_contents() 将返回 FALSE。 file_get_contents() 函数是用来将文件的内容读入到一个字符串中的首选方法。如果操作系统支持还会使用内存映射技术来增强性能。 Note: 如果要打开有特殊字符的 URL (比如说有空格),就需要使用 urlencode() 进行 URL 编码。 Note: context 参数可以用 NULL 来忽略。 
      

  5.   

    什么意思... 要么curl,那么file_get_contents,fopen这些接口,传入stream_context_create构造的HTTP请求给context参数,一步就完成了请求与接收。