企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
ihttp\_get() - 封装的 GET 请求方法 ### 说明 ~~~ ihttp_get($url) ~~~ ### 参数 * **$url**要获取内容的URL,必须是以http或是https开头 ### 返回值 #### error 可用is\_error判断,详见《错误处理》 #### success ~~~ array( 'code' => 200 //http 状态码 'status' => OK //http 状态信息 'responseline' => HTTP/1.1 200 OK 'headers' => array ( //返回头部的一些信息,这里是直接显示百度的返回头部信息 //具体功能函数不在这里赘述,可以查看HTTP相关文档 'Server' => bfe/1.0.8.18 'Date' => Wed, 21 Sep 2016 03:23:54 GMT 'Content-Type' => text/html; charset=utf-8 'Connection' => close 'Vary' => Accept-Encoding 'P3P' => CP=" OTI DSP COR IVA OUR IND COM " 'Cache-Control' => private 'Cxy_all' => baidu+7cf6bc2c9c5ae104a1dad56cb1e2a027 'Expires' => Wed, 21 Sep 2016 03:22:58 GMT 'X-Powered-By' => HPHP 'X-UA-Compatible' => IE=Edge,chrome=1 'Strict-Transport-Security' => max-age=604800 'BDPAGETYPE' => 1 'BDQID' => 0x9f936d6300036048 'BDUSERID' => 0 // 此处返回服务器给客户端设置的Cookie信息 // 下面的例子中会有怎么使用的例子 'Set-Cookie' => array ( '0' => H_PS_PSSID=1437_21014_17944_21127_; path=/; domain=.baidu.com '1' => __bsi=1222377018390; expires=Wed, 21-Sep-16 03:23:59 GMT; domain=www.baidu.com; path=/ ) ) 'content' => '<!DOCTYPE html><!--STATUS OK--><html><head>..省略3千字...</body></html>' //网页的HTML内容) ~~~ ### 示例 ~~~ load()->func('communication'); $response = ihttp_get('http://baidu.com');print_r($response['content']); // 输出百度页面Html ~~~