public function save_curl()
 {
     $uid = curl_uid();
     //通过微信API获取学号
     $pic = curl_pic();
     //从微信端扒照片保存到allimage,返回值为文件名 ./Public/allimage/**.--
     $info = curl_info();
     //通过微信API获取学生信息
     D('User')->save_in_User($uid, $info);
     //在User表中新增上传照片的学生信息
     D('Image')->save_in_Image($uid, $pic, $info);
     //在Image表中新增上传照片的照片信息
 }
Exemple #2
0
<?php

function curl_info($url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $content = curl_exec($ch);
    $info = curl_getinfo($ch);
    return $info;
}
$site = 'http://intranettommasi.ddns.net:1989/intranet';
$info = curl_info($site);
if ($info['http_code'] == 200) {
    echo '<u>' . $site . '</u> - <strong>está no ar!!</strong><br />';
} else {
    echo '<u>' . $site . '</u> - está fora do ar<br />';
}
$site = 'http://www.locaweba.com.br';
$info = curl_info($site);
if ($info['http_code'] == 200) {
    echo '<u>' . $site . '</u> - <strong>está no ar!!</strong><br />';
} else {
    echo '<u>' . $site . '</u> - está fora do ar<br />';
}
Exemple #3
0
/**
 * get_cookie() 函数用来获取响应头部中的 Cookie
 * @return string       返回所有匹配的 Cookie 字符串
 */
function get_cookie()
{
    $responseHeaders = curl_info('response_headers');
    if (empty($responseHeaders['Set-Cookie'])) {
        return false;
    }
    if (is_string($responseHeaders['Set-Cookie'])) {
        return strstr($responseHeaders['Set-Cookie'], ';', true);
    }
    foreach ($responseHeaders['Set-Cookie'] as $value) {
        @($cookie .= strstr($value, ';', true) . '; ');
    }
    return rtrim($cookie, '; ');
}
 /**
  * 获取公告内容
  */
 public static function get_notice_info()
 {
     $use_api_notice = false;
     $notice = __lan("欢迎使用BigApp,如果您在使用过程中遇到任何问题,请随时与我们联系,我们将终身提供免费技术支持服务,<strong>QQ: 2510709749;免费电话: 4006852216;</strong><br><br>\n            请先前往<a href='http://bigapp.youzu.com' target='_blank'> BigApp应用中心 </a> 进行认证,并生成您的App!");
     if ($use_api_notice == true) {
         $notice_info = curl_info("http://bigapp.youzu.com/mc/mcapi/getNotice");
         if ($notice_info && $notice_info['error_code'] == 0) {
             $notice = $notice_info['data']['notice'] ? $notice_info['data']['notice'] : $notice;
         }
     }
     return $notice;
 }