Esempio n. 1
0
 public function doRequestParam2($arrInterface, $strUrlPram, $arrUserInfo, $arrChange, $strAction, $boolShowLog)
 {
     if (empty($arrInterface)) {
         return -1;
     }
     $arrParam = self::$objParamHandler->genData($arrInterface['args'], $arrChange, $strAction);
     if ($arrInterface['needCookie']) {
         $arrInterface['host'][CURLOPT_COOKIE] = $arrUserInfo['cookie'];
     }
     if (empty($strAction)) {
         $arrParam = array();
     }
     $strUrl = $arrInterface['url'] . '?' . $strUrlPram;
     var_dump($arrParam);
     $boolLoopFlag = true;
     while ($boolLoopFlag) {
         if ($arrInterface['isPost']) {
             $ret = Curl_class::curl_post($strUrl, $arrParam, $arrInterface['host']);
         } else {
             $ret = Curl_class::curl_get($strUrl, $arrParam, $arrInterface['host']);
         }
         $mixBody = json_decode($ret['body'], true);
         if (!is_array($mixBody)) {
             $mixBody['body'] = $ret['body'];
         }
         $strHeader = $ret['header'];
         if ($boolShowLog) {
             ColourMsg::display("interface", $arrInterface);
             ColourMsg::display("strUrl", $strUrl);
             ColourMsg::display("arrChange", $arrChange);
             ColourMsg::display("param", $arrParam);
             ColourMsg::display("arrUserInfo", $arrUserInfo);
             ColourMsg::display("Cookie", $arrInterface['host']);
             unset($ret['header']);
             ColourMsg::display("request result", $ret);
         }
         if ($ret['http_code'] != 200) {
             if (302 === $ret['http_code']) {
                 $mixBody['http_code'] = 302;
                 $mixBody['location'] = $this->getLocationFromHeader($strHeader);
                 $boolLoopFlag = false;
             } else {
                 $boolLoopFlag = true;
             }
         } else {
             $mixBody['http_code'] = 200;
             $mixBody['location'] = '';
             $boolLoopFlag = false;
         }
     }
     return $mixBody;
 }
Esempio n. 2
0
 public static function display($strTitle, $mixMsg, $boolBlink = false)
 {
     if (empty(self::$strFrameBackColour) || empty(self::$strFrameFontColour)) {
         self::setFrameColour('cerulean', 'black');
     }
     if (empty(self::$strTitleBackColour) || empty(self::$strTitleFontColour)) {
         self::setTitleColour('blue', 'black');
     }
     if (empty(self::$strContentBackColour) || empty(self::$strContentFontColour)) {
         self::setContentColour('yellow', 'black');
     }
     ColourMsg::formatFrame(null, null);
     ColourMsg::formatTitle($strTitle, null, null);
     if (is_string($mixMsg) || is_numeric($mixMsg)) {
         $strMsg = $mixMsg;
     } else {
         $jsonMsg = json_encode($mixMsg);
         $arrMsg = json_decode($jsonMsg, true);
         #$strMsg = var_export($arrMsg, true);
         $strMsg = print_r($arrMsg, true);
     }
     $arrMsg = explode("\n", $strMsg);
     foreach ($arrMsg as $strLine) {
         self::formatSingleLine($strLine, null, null, $boolBlink);
     }
     echo self::$strColourLineLast;
 }