private function sendFleetOut($f3_page) { date_default_timezone_set('Asia/Taipei'); //holdingtime=1&expeditiontime=1&token=835326b1f0586f2bf3035c8f5c49c1b9 //&galaxy=1&system=104&position=13&type=1&mission=1&union2=0&holdingOrExpTime=0 //&speed=1&acsValues=-&am203=1&metal=0&crystal=0&deuterium=0 $COOKIE_FILE = $this->Config['COOKIE_FILE']; $MOVEMENT = $this->Config['MOVEMENT']; $f3 = GlobalFunc::loadHTML($f3_page); //get token $wrap = $f3->getElementById("wrap"); if (!is_object($wrap)) { echo "Error occur, wrap is not found, return 0\n"; return 0; } $inputs = $wrap->getElementsByTagName("input"); $token = ""; for ($i = 0; $i < $inputs->length; $i++) { $input = $inputs->item($i); $input_name = $input->attributes->getNamedItem('name')->nodeValue; //echo "Input name = ". $input_name; if ($input_name == "token") { $token = $input->attributes->getNamedItem('value')->nodeValue; break; } } //get total resource $resources = GlobalFunc::getResources($f3_page); //get consumption of the fly $c_dom = $f3->getElementById("consumption"); //特例<span id="consumption"> <span></span> </span> 用getElementsByTagName()->item(0)找不到 $consumption = trim($c_dom->firstChild->textContent); //get total space for resource $max_resource = $f3->getElementById("maxresources")->textContent; $max_resource = GlobalFunc::strToIntByTakeCommaOff($max_resource); //get time length to arrive target //15:34:43 h $duration = $f3->getElementById("duration")->textContent; $duration = trim(substr($duration, 0, strlen($duration) - 1)); //get 15:34:43 $d_array = explode(":", $duration); //explode()輸出的array沒有length 只能用sizeof if (sizeof($d_array) == 3) { //有小時 $duration = $d_array[0] * 3600 + $d_array[1] * 60 + $d_array[2]; } else { if (sizeof($d_array) == 2) { $duration = $d_array[0] * 60 + $d_array[1]; } else { $duration = $d_array[0]; } } $this->setDuration($duration); //get off all resources if it's capable of. $resources_taken_uri = $this->getAllResourcesCanBeTaken($max_resource, $resources); //$resources_taken_uri = ""; //$left_space = $max_resource; //$resources_taken_uri .= $this->getAllResourcesCanBeTaken( $info, "darkmatter", $resources ); //$resources_taken_uri .= $this->getAllResourcesCanBeTaken( $info, "deuterium", $resources ); //$resources_taken_uri .= $this->getAllResourcesCanBeTaken( $info, "crystal", $resources ); //$resources_taken_uri .= $this->getAllResourcesCanBeTaken( $info, "metal", $resources ); $this->rUri .= "&holdingtime=1&expeditiontime=1&holdingOrExpTime=0"; $this->rUri .= "&token=" . $token . $resources_taken_uri; //echo "resources_taken_uri: " . $resources_taken_uri . "\n"; //echo "rUri: " . $this->rUri . "\n"; //echo "URI : ". $this->rUri." \n"; //echo "==============================duration ".$this->duration; $data = GlobalFunc::uriToJson($this->rUri); $this->time_before_sent = time(); return GlobalFunc::httpPost($MOVEMENT, $data, $COOKIE_FILE); }