/**
* 发送数据
* @param $url 准备发送的url
* @param $options 系统配置
*/
public static function send_post($url, $options){
//获取API
$api = $options->plugin('BaiduSubmitTest')->api;
//准备数据
if( is_array($url) ){
$urls = $url;
}else{
$urls = array($url);
}
$ch = curl_init();
$options = array(
CURLOPT_URL => $api,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => implode("\n", $urls),
CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
);
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
//记录日志
file_put_contents('/tmp/send_log', date('H:i:s') . $result . "\n");
}
public static function send_post($url, $options){
//获取API
$api = $options->plugin('BaiduSubmitTest')->api;
//准备数据
if( is_array($url) ){
$urls = $url;
}else{
$urls = array($url);
}
//为了保证成功调用,老高先做了判断
if (false == Typecho_Http_Client::get()) {
throw new Typecho_Plugin_Exception(_t('对不起, 您的主机不支持 php-curl 扩展而且没有打开 allow_url_fopen 功能, 无法正常使用此功能'));
}
//发送请求
$http = Typecho_Http_Client::get();
$http->setData(implode("\n", $urls));
$http->setHeader('Content-Type','text/plain');
$result = $http->send($api);
//记录日志
file_put_contents('/tmp/send_log', date('H:i:s') . $result . "\n");
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有