雅虎新闻|| BBC新闻|| CNN新闻|| 美元指数|| 中国期货指数|| 股票指数|| 黄金|| 外汇|| 英汉互译|| 昭放工具
163邮箱|| 126邮箱|| 新浪邮箱|| 企业邮箱|| 21cn邮箱|| tom邮箱|| 搜狐邮箱|| hotmail邮箱|| msn邮箱|| qq邮箱

用户登录

设为主页| 淘宝铺| 加入收藏|
您的IP:3.148.115.202您的操作系统:Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
个人便签
知识库
fsockopen,pfsockopen函数被禁用时的修改办法

DISCUZ已经能判断当不支持fsockopen,pfsockopen时使用stream_socket_client来建立连接

 

但UC还没这样的处理。我们主要是修改UC。

 

修改uc_client/client.php

搜索

if(function_exists('fsockopen')) {

$fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);

} elseif (function_exists('pfsockopen')) {

$fp = @pfsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);

} else {

$fp = false;

}

修改为

if(function_exists('fsockopen')) {

$fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);

} elseif (function_exists('pfsockopen')) {

$fp = @pfsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);

} elseif(function_exists('stream_socket_client')) {

$fp = @stream_socket_client($ip.':'.$port, $errno, $errstr, $timeout);

} else {

$fp = false;

}

uc_client/model/misc.php

搜索

if(function_exists('fsockopen')) {

$fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);

} elseif (function_exists('pfsockopen')) {

$fp = @pfsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);

} else {

$fp = false;

}

修改为

if(function_exists('fsockopen')) {

$fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);

} elseif (function_exists('pfsockopen')) {

$fp = @pfsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);

} elseif(function_exists('stream_socket_client')) {

$fp = @stream_socket_client($ip.':'.$port, $errno, $errstr, $timeout);

} else {

$fp = false;

}

uc_server/model/misc.php

搜索

if(function_exists('fsockopen')) {

$fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);

} elseif (function_exists('pfsockopen')) {

$fp = @pfsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);

} else {

$fp = false;

}

修改为

if(function_exists('fsockopen')) {

$fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);

} elseif (function_exists('pfsockopen')) {

$fp = @pfsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);

} elseif(function_exists('stream_socket_client')) {

$fp = @stream_socket_client($ip.':'.$port, $errno, $errstr, $timeout);

} else {

$fp = false;

}

改完这三个文件后,通信成功了,但数据同步还是失败的,还需要在UC应用管理里给应用IP 填上网站的IP。

星期二, 07/22/2014 - 11:34 — 杨超