本文整理汇总了PHP中Utility::HttpRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP Utility::HttpRequest方法的具体用法?PHP Utility::HttpRequest怎么用?PHP Utility::HttpRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utility
的用法示例。
在下文中一共展示了Utility::HttpRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_base_info
public function get_base_info()
{
$query_data = array('api_id' => $this->appid, 'api_secret' => $this->appsecret);
$sendurl = $this->api_url . http_build_query($query_data);
$result = Utility::HttpRequest($sendurl);
die(dump($result));
}
示例2: ip_location_youdao
function ip_location_youdao($ip)
{
$u = "http://www.youdao.com/smartresult-xml/search.s?type=ip&q={$ip}";
$r = mb_convert_encoding(Utility::HttpRequest($u), 'UTF-8', 'GBK');
preg_match("#<location>(.+)</location>#Ui", $r, $m);
return strval($m[1]);
}
示例3: sms_send
function sms_send($phone, $content)
{
global $INI;
if (mb_strlen($content, 'UTF-8') < 20) {
return '短信长度低于20汉字?长点吧~';
}
/* include customsms function */
$smsowner_file = dirname(__FILE__) . '/smsowner.php';
if (file_exists($smsowner_file)) {
require_once $smsowner_file;
if (function_exists('sms_send_owner')) {
return sms_send_owner($phone, $content);
}
}
/* end include */
$user = strval($INI['sms']['user']);
$pass = strtolower(md5($INI['sms']['pass']));
if (null == $user) {
return true;
}
$content = urlEncode($content);
$api = "http://notice.zuitu.com/sms?user={$user}&pass={$pass}&phones={$phone}&content={$content}";
$res = Utility::HttpRequest($api);
return trim(strval($res)) == '+OK' ? true : strval($res);
}
示例4: zuitu_action
function zuitu_action($action, $version = 'V1.0')
{
global $INI;
$user = $INI['sms']['user'];
$host = strtolower(strval($_SERVER['HTTP_HOST']));
$url = "http://notice.zuitu.com/version.php?action={$action}&version={$version}&user={$user}&host={$host}";
$r = Utility::HttpRequest($url);
return json_decode($r, true);
}
示例5: config_url_add
public function config_url_add($data)
{
include_once TOA_ROOT . 'include/class_Utility.php';
$httpurl = $this->confgi_url() . '/office/' . $this->config_oaurl($data) . '?uid=' . $this->config_data('com_userid') . '&number=' . $this->config_data('com_number');
$re_user = Utility::HttpRequest($httpurl);
$content = array();
$content['version'] = array('copyright' => $re_user);
write_to_file('version', $content);
return $re_user;
}
示例6: sms_send
function sms_send($phone, $content)
{
global $INI;
if (mb_strlen($content, 'UTF-8') < 20) {
return '短信长度低于20汉字?长点吧~';
}
$user = $INI['sms']['user'];
$pass = strtolower(md5($INI['sms']['pass']));
$content = urlEncode($content);
$api = "http://notice.zuitu.com/sms?user={$user}&pass={$pass}&phones={$phone}&content={$content}";
$res = Utility::HttpRequest($api);
return trim(strval($res)) == '+OK' ? true : strval($res);
}
示例7: get_city
function get_city($ip = null)
{
$cities = option_category('city', false, true);
$ip = $ip ? $ip : Utility::GetRemoteIP();
$url = "http://open.baidu.com/ipsearch/s?wd={$ip}&tn=baiduip";
$res = mb_convert_encoding(Utility::HttpRequest($url), 'UTF-8', 'GBK');
if (preg_match('#来自:<b>(.+)</b>#Ui', $res, $m)) {
foreach ($cities as $one) {
if (FALSE !== strpos($m[1], $one['name'])) {
return $one;
}
}
}
return array();
}
示例8: remote_action
function remote_action($action, $version = 'V1.0', $condition = array ()) {
global $INI;
// $api = "ustore.tuanzbao.com"; //服务器地址
// $api = "127.0.0.1:8080"; //服务器地址
$api = USTORE_REMOTE_HOST;
$host = strtolower(strval($_SERVER['HTTP_HOST']));
$user = $INI['sms']['smsbao_user']; //平台帐号
$pass = md5($INI['sms']['smsbao_pass']); //短信平台密码
$url = "{$api}/rest/{$action}?version={$version}&user={$user}&password={$pass}&host=" . urlencode($host) . buildCondition($condition);
// die($url);
$r = Utility :: HttpRequest($url);
// die($r);
return json_decode($r, true);
}
示例9: PHONE_ADD_POST
function PHONE_ADD_POST($person = 0, $content = 0, $receiveperson = 0, $type = 0, $url = 0, $userid = 0)
{
//判断当前可用通道
global $db;
$blog = $db->fetch_one_array("SELECT * FROM " . DB_TABLEPRE . "phone_channel where id=1 and pkey='1' and (type='2' or type='3') order by id desc");
//获取账户信息
$username = $blog["username"];
$password = $blog["password"];
//获取接口信息
$connection = explode('#515158#', $blog["connection"]);
$personfor = explode(',', $person);
$receivepersonfor = explode(',', $receiveperson);
//$ef='';
for ($i = 0; $i < sizeof($personfor); $i++) {
if ($personfor[$i] != '') {
$date = get_date('y-m-d H:i:s', PHP_TIME);
$sms_add = explode('#01', $connection[2]);
$ugcode_vod = new ugcode();
$contentgdb2312 = $ugcode_vod->ugcode_vod(1, $content);
$phoneurl = $sms_add[0] . trim($username) . $sms_add[1] . trim($password) . $sms_add[2] . trim($personfor[$i]) . $sms_add[3] . trim($contentgdb2312) . $sms_add[4] . $sms_add[5];
$res = Utility::HttpRequest($phoneurl);
if ($blog["connectionid"] == '1') {
$res_sms = explode('/', $res);
if ($res_sms[0] == '000') {
$type = '1';
} else {
$type = '2';
}
} else {
$res_sms = explode('&', $res);
if ($res_sms[0] == 'result=0') {
$type = '1';
} else {
$type = '2';
}
}
//数据入库
$phone_send = array('content' => $content, 'receivephone' => $personfor[$i], 'sendperson' => $userid, 'receiveperson' => $receivepersonfor[$i], 'date' => get_date('y-m-d H:i:s', PHP_TIME), 'type' => $type, 'channelid' => $blog["id"]);
insert_db('phone_send', $phone_send);
sleep(1);
}
}
}
示例10: check_balans_rest
function check_balans_rest()
{
$settings = get_settings();
if ($settings['sms_api_username'] == '' || $settings['sms_api_password'] == '') {
//echo '<p>Не указаны параметры для отправки СМС !</p>';
return false;
}
$rest_credits = Utility::HttpRequest('http://api.iqsms.ru/messages/v2/balance/', array('login' => $settings['sms_api_username'], 'password' => $settings['sms_api_password']));
if ($rest_credits) {
$rest_credits_ar = explode(';', $rest_credits);
if ($rest_credits_ar[0] == 'RUB' && isset($rest_credits_ar[1])) {
return (int) $rest_credits_ar[1];
} else {
return false;
}
} else {
return false;
}
}
示例11: get_city
function get_city($ip = null)
{
global $INI;
$hotcity_keys = array_keys($INI['hotcity']);
$cities = DB::LimitQuery('category', array('condition' => array('zone' => 'city'), 'cache' => 2592000));
$ip = $ip ? $ip : Utility::GetRemoteIP();
$url = "http://open.baidu.com/ipsearch/s?wd={$ip}&tn=baiduip";
$res = mb_convert_encoding(Utility::HttpRequest($url), 'UTF-8', 'GBK');
$city = array();
if (preg_match('#来自:<b>(.+)</b>#Ui', $res, $m)) {
foreach ($cities as $one) {
if (FALSE !== strpos($m[1], $one['name'])) {
$city = $one;
break;
}
}
}
if (!in_array($city['ename'], $hotcity_keys)) {
return DB::LimitQuery('category', array('condition' => array('zone' => 'city', 'ename' => $hotcity_keys[0]), 'one' => true));
}
return $city;
}
示例12: elseif
if ($do == 'list') {
include_once 'template/version.php';
} elseif ($do == 'save') {
for ($i = 1; $i <= 16; $i++) {
if ($i % 4 == 0 && $i < 16) {
$strs = '-';
} else {
$strs = '';
}
$namearr .= getGP('t' . $i . '', 'P') . $strs;
}
if (getGP('com_number', 'P') != '') {
$namearr = getGP('com_number', 'P');
}
$httpurl = $_CONFIG->confgi_url() . '/office/' . $_CONFIG->config_oaurl('version') . '?nums=' . $_POST["nums"] . '&number=' . strtoupper(trim($namearr));
$re_user = Utility::HttpRequest($httpurl . '&date=' . get_date('YmdHis', PHP_TIME));
$re_user = explode('|', $re_user);
//数据处理
if ($re_user[0] != '1') {
//com_name
if ($_CONFIG->config_data_name('com_name') != '') {
get_config_update('com_name', $re_user[0]);
} else {
get_config_insert('com_name', $re_user[0]);
}
//com_person
if ($_CONFIG->config_data_name('com_person') != '') {
get_config_update('com_person', $re_user[1]);
} else {
get_config_insert('com_person', $re_user[1]);
}
示例13: sms_send_smsbao
function sms_send_smsbao($phone, $content) {
global $INI;
if (empty($content)) {
return '短信内容为空?写点吧~';
}
$content = Utility::Content($content);
//配置信息
$smsapi = "api.smsbao.com"; //短信网关
$charset = "utf8"; //文件编码
$user = $INI['sms']['smsbao_user']; //短信平台帐号
$pass = md5($INI['sms']['smsbao_pass']); //短信平台密码
$wwwprefix = $INI['system']['wwwprefix'];
$statusStr = array(
"0" => "短信发送成功",
"-1" => "参数不全",
"-2" => "服务器空间不支持,请确认支持curl或者fsocket,联系您的空间商解决或者更换空间!",
"30" => "密码错误",
"40" => "账号不存在",
"41" => "余额不足",
"42" => "帐户已过期",
"43" => "IP地址限制",
"50" => "内容含有敏感词"
);
if (function_exists('curl_exec') == 1)
{
//发送地址
$sendurl = "http://{$smsapi}/sms?u={$user}&p={$pass}&m={$phone}&c=".urlencode($content)."&r=".urlencode($wwwprefix."/api/smsbao.php?type=feedback");
$result = Utility::HttpRequest($sendurl);
}else{
include_once("snoopy.php");
$snoopy = new snoopy();
$sendurl = "http://{$smsapi}/sms?u={$user}&p={$pass}&m={$phone}&c=".urlencode($content)."&r=".urlencode($wwwprefix."/api/smsbao.php?type=feedback");
$snoopy->fetch($sendurl);
$result = $snoopy->results;
}
if (trim(strval($result))=='') $result='-2';
$code = intval(trim($result));
if($code == 0){
return true;
}else{
return $statusStr[$code];
}
}
示例14: exit
(!defined('IN_TOA') || !defined('IN_ADMIN')) && exit('Access Denied!');
if (!is_superadmin()) {
prompt('对不起,你没有权限执行本操作!');
}
get_key("office_sms_read");
empty($do) && ($do = 'list');
if ($do == 'list') {
global $db;
$blog = $db->fetch_one_array("SELECT * FROM " . DB_TABLEPRE . "phone_channel where id=1 and pkey='1' and (type='2' or type='3') order by id desc");
//获取账户信息
$username = $blog["username"];
$password = $blog["password"];
$connection = explode('#515158#', $blog["connection"]);
$sms_add = explode('#01', $connection[3]);
$phoneurl = $sms_add[0] . trim($username) . $sms_add[1] . trim($password);
$res = Utility::HttpRequest($phoneurl);
$rqnum = explode('||', $res);
for ($i = 0; $i < sizeof($rqnum); $i++) {
$revalue = explode('#', $rqnum[$i]);
if ($rqnum[$i] != '') {
$phone_receive = array('content' => u8gb($revalue[1]), 'sendphone' => $revalue[0], 'date' => $revalue[2]);
//接收消息表
insert_db('phone_receive', $phone_receive);
}
}
//////////////////////////////////////////////
//读数据
//列表信息
$wheresql = '';
$page = max(1, getGP('page', 'G', 'int'));
$pagesize = 20;
示例15: date_default_timezone_get
if (date_default_timezone_get()) {
echo 'date_default_timezone_set: ' . date_default_timezone_get() . '<br />';
}
if (ini_get('date.timezone')) {
echo 'date.timezone: ' . ini_get('date.timezone') . '<br />';
}
$now = date("Y-m-d H:i:s");
echo "<p>дата - {$now}</p>";
$dateTime = new DateTime("now", new DateTimeZone('GMT'));
$mysqldate = $dateTime->format("Y-m-d H:i:s");
echo "<p>дата для mysql - {$mysqldate}</p>";
echo '<p>узнаем текущий баланс JSON</p>';
var_dump($gate->credits());
// узнаем текущий баланс
echo '<p>узнаем текущий баланс REST</p>';
$rest_credits = Utility::HttpRequest('http://api.iqsms.ru/messages/v2/balance/', array('login' => 'z1469184353311', 'password' => '948621'));
$rest_credits = explode(';', $rest_credits);
var_dump($rest_credits);
echo '<p>получаем список доступных подписей</p>';
var_dump($gate->senders());
// получаем список доступных подписей
$messages = array(array("clientId" => "1", "phone" => "79222605250", "text" => "Тестовое сообщение"));
//var_dump($gate->send($messages, 'testQueue')); // отправляем пакет sms
/*$messages = array(
array("clientId"=>"1","smscId"=>1885654369),
// array("clientId"=>"2","smscId"=>11255143),
// array("clientId"=>"3","smscId"=>11255144),
);*/
echo '<p>получаем статусы для пакета sms</p>';
var_dump($gate->status($messages));
// получаем статусы для пакета sms