Esempio n. 1
0
 /**
  * @param $url
  * @param array $fileinfo
  * @param null $status
  * @param bool $debug
  * @throws Exception
  * @return bool
  */
 public function getRemoteImage($url, array $fileinfo, $status = null, $debug = false)
 {
     if (is_array($fileinfo)) {
         $opt = $fileinfo;
     } else {
         throw new Exception('getRemoteImage fileinfo is not array');
     }
     if (isset($opt['path'])) {
         if (is_dir($opt['path'])) {
             $path = $opt['path'];
         }
     } else {
         $path = false;
     }
     if (isset($opt['image'])) {
         if (is_file($opt['image'])) {
             $image = $opt['image'];
         }
     } else {
         $image = false;
     }
     $curl = new http_curl();
     $curl->copyRemoteFile($url, $path, $status, $debug);
 }
Esempio n. 2
0
 function VSweibo($ybrow, $text)
 {
     $http = new http_curl();
     $http->from = "http://vsdh.yiban.cn/weibo";
     $loginUrl = "http://vsdh.yiban.cn/weibo/index.php?view=ajax&action=publish";
     $http->file = md5($ybrow['ybuser']) . '.cookie';
     $postStr = 'pic=0&content=' . urlencode($text);
     // echo $postStr;
     $header = array('Host' => 'vsdh.yiban.cn', 'Accept' => 'application/json, text/javascript, */*; q=0.01', 'Accept-Language' => 'zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3', 'Accept-Encoding' => 'gzip, deflate, br', 'Content-Type' => 'application/x-www-form-urlencoded; charset=UTF-8', 'X-Requested-With' => 'XMLHttpRequest', 'Connection' => 'keep-alive');
     $cookie = 'login_username='******'ybuser'] . '; LUN=' . $ybrow['ybuser'] . '; POWER=100; isVip=0;timezone=-8; UID=' . $ybrow['ybid'] . '; AREA=43; OS=%B2%E9%BF%B4%B2%A9%CE%C4;';
     $re = $http->post($loginUrl, $postStr, $header, $cookie);
     // $json=json_decode($re[1],true);
     //echo $re[0];
     //echo htmlspecialchars($re[1]);
 }
Esempio n. 3
0
 function ZanTong($user, $theid, $trendsId, $num)
 {
     $http = new http_curl();
     $http->from = "http://www.yiban.cn/user/index/index/user_id/" . $theid;
     $up = "http://www.yiban.cn/feed/up";
     $down = "http://www.yiban.cn/feed/down";
     $http->file = md5($user) . '.cookie';
     $postStr = "id=" . $trendsId;
     switch ($num) {
         case 0:
             break;
         case 1:
             $re = $http->post($up, $postStr, $this->headerArray);
             $json = empty($re[1]) ? 0 : json_decode($re[1], true);
             print_r($json);
             break;
         case 2:
             $re = $http->post($down, $postStr, $this->headerArray);
             $json = empty($re[1]) ? 0 : json_decode($re[1], true);
             print_r($json);
             break;
         case 3:
             $re = $http->post($up, $postStr, $this->headerArray);
             $json = empty($re[1]) ? 0 : json_decode($re[1], true);
             print_r($json);
             $re = $http->post($down, $postStr, $this->headerArray);
             $json = empty($re[1]) ? 0 : json_decode($re[1], true);
             print_r($json);
             break;
         default:
             break;
     }
     return '';
 }