func_global.php
资源名称:BBWPS.rar [点击查看]
上传用户:yttaitong
上传日期:2009-05-10
资源大小:128k
文件大小:1k
源码类别:
WEB源码(ASP,PHP,...)
开发平台:
PHP
- <?
- /*
- [BBWPS!] (C)2006-2010 小蜜蜂版权所有.
- This is NOT a freeware, use is subject to license terms
- 时间:2007年12月
- 描述:函数
- */
- function openFileRemote($url,$cookie="",$referer=""){
- require_once("./class/http_class.php");
- $urlArray=parse_url($url);
- $host=$urlArray["host"];
- $port=$urlArray["port"];
- if(!$port)$port=80;
- $client=new HttpClient($host,$port);
- $path=$urlArray["path"];
- $data=$urlArray["query"];
- if($data){
- $data=str_replace("&","&",$data);
- $dataArray=explode("&",$data);
- $dataArray=array_unique($dataArray);
- foreach ($dataArray as $value){
- if($value){
- $v=explode("=",$value);
- $k=trim($v[0]);
- $dataA[$k]=trim($v[1]);
- }
- }
- }
- if($cookie){
- $cookieArray=preg_split("/,|,|,/is",$cookie);
- foreach ($cookieArray as $value){
- $cookieArrayTemp=explode("=",$value,2);
- $cookies[$cookieArrayTemp[0]]=$cookieArrayTemp[1];
- unset($cookieArrayTemp);
- }
- unset($cookieArray);
- $client->setCookies($cookies);
- }
- if($referer){
- $client->referer=$referer;
- }
- else{
- $client->referer=$host;
- }
- $client->get($path,$dataA);
- $content= $client->getContent();
- if(!$content){
- set_time_limit(300);
- return file_get_contents($url);
- }
- else{
- return $content;
- }
- }
- ?>