本文整理汇总了PHP中_dfsockopen函数的典型用法代码示例。如果您正苦于以下问题:PHP _dfsockopen函数的具体用法?PHP _dfsockopen怎么用?PHP _dfsockopen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_dfsockopen函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query
public function query($com, $nu, $show = '0', $muti = 1) {
if(empty($com) || empty($nu)) return FALSE;
$this->par['type'] = $com;
$this->par['postid'] = $nu;
$result = _dfsockopen($this->url.http_build_query($this->par));
if($result) {
$result = json_decode($result, TRUE);
if($result['status'] == 0) {
$this->error = '物流单暂无结果';
return FALSE;
} elseif($result['status'] == 2) {
$this->error = '接口出现异常';
return FALSE;
} else {
unset($result['status']);
switch ($result['state']) {
case '0':
$result['message'] = '在途';
break;
case '1':
$result['message'] = '揽件';
break;
case '2':
$result['message'] = '疑难';
break;
case '3':
$result['message'] = '签收';
break;
case '4':
$result['message'] = '退签';
break;
case '5':
$result['message'] = '派件';
break;
case '6':
$result['message'] = '退回';
break;
default:
$result['message'] = '其他';
break;
}
return $result;
}
} else {
$this->error = '查询失败,请稍候重试';
return FALSE;
}
}
示例2: dfsockopen
function dfsockopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $ip = '', $timeout = 15, $block = TRUE, $encodetype = 'URLENCODE', $allowcurl = TRUE, $position = 0)
{
require_once libfile('function/filesock');
return _dfsockopen($url, $limit, $post, $cookie, $bysocket, $ip, $timeout, $block, $encodetype, $allowcurl, $position);
}
示例3: dfsockopen
function dfsockopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $ip = '', $timeout = 15, $block = TRUE, $encodetype = 'URLENCODE', $allowcurl = TRUE)
{
return _dfsockopen($url, $limit, $post, $cookie, $bysocket, $ip, $timeout, $block, $encodetype, $allowcurl);
}
示例4: dfsockopen
function dfsockopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $ip = '', $timeout = 15, $block = TRUE)
{
require_once libfile('function/filesock');
return _dfsockopen($url, $limit, $post, $cookie, $bysocket, $ip, $timeout, $block);
}
示例5: init
private function init($method, $source, $target, $nosuffix = 0)
{
//global $_G;
$this->errorcode = 0;
if (empty($source)) {
return -2;
}
$parse = parse_url($source);
if (isset($parse['host'])) {
if (empty($target)) {
return -2;
}
$data = _dfsockopen($source);
$this->tmpfile = $source = tempnam('/data/temp/', 'tmpimg_');
file_put_contents($source, $data);
if (!$data || $source === FALSE) {
return -2;
}
}
if ($method == 'thumb') {
$target = empty($target) ? !$nosuffix ? $this->getimgthumbname($source) : $this->getimgthumbname($source, '.' . $nosuffix . '.jpg', false) : $target;
//PWEB_UPLOAD_URL
} elseif ($method == 'watermask') {
$target = empty($target) ? $source : '/data/' . $target;
}
$targetpath = dirname($target);
if (!is_dir($targetpath)) {
@mkdir($targetpath, 0777, true);
}
clearstatcache();
if (!is_readable($source) || !is_writable($targetpath)) {
return -2;
}
$imginfo = @getimagesize($source);
if ($imginfo === FALSE) {
return -1;
}
$this->source = $source;
$this->target = $target;
$this->imginfo['width'] = $imginfo[0];
$this->imginfo['height'] = $imginfo[1];
$this->imginfo['mime'] = $imginfo['mime'];
$this->imginfo['size'] = @filesize($source);
$this->libmethod = $this->param['imagelib'] && $this->param['imageimpath'];
if (!$this->libmethod) {
switch ($this->imginfo['mime']) {
case 'image/jpeg':
$this->imagecreatefromfunc = function_exists('imagecreatefromjpeg') ? 'imagecreatefromjpeg' : '';
$this->imagefunc = function_exists('imagejpeg') ? 'imagejpeg' : '';
break;
case 'image/gif':
$this->imagecreatefromfunc = function_exists('imagecreatefromgif') ? 'imagecreatefromgif' : '';
$this->imagefunc = function_exists('imagegif') ? 'imagegif' : '';
break;
case 'image/png':
$this->imagecreatefromfunc = function_exists('imagecreatefrompng') ? 'imagecreatefrompng' : '';
$this->imagefunc = function_exists('imagepng') ? 'imagepng' : '';
break;
}
} else {
$this->imagecreatefromfunc = $this->imagefunc = TRUE;
}
if (!$this->libmethod && $this->imginfo['mime'] == 'image/gif') {
if (!$this->imagecreatefromfunc) {
return -4;
}
if (!($fp = @fopen($source, 'rb'))) {
return -2;
}
$content = fread($fp, $this->imginfo['size']);
fclose($fp);
$this->imginfo['animated'] = strpos($content, 'NETSCAPE2.0') === FALSE ? 0 : 1;
}
return $this->imagecreatefromfunc ? 1 : -4;
}