public static function GetShippingPrice($zip_from, $zip_to, $weight, $length, $height, $width, $diameter = 0, $onHands = false, $notify = false, $recoverValue = 0) { $data = array('sCepOrigem' => $zip_from, 'sCepDestino' => $zip_to, 'nVlPeso' => intval($weight), 'nCdFormato' => 1, 'nVlComprimento' => $length, 'nVlAltura' => $height, 'nVlLargura' => $width, 'nVlDiametro' => $diameter, 'sCdMaoPropria' => $onHands ? 's' : 'n', 'nVlValorDeclarado' => intval($recoverValue), 'sCdAvisoRecebimento' => $notify ? 's' : 'n', 'nCdServico' => '40010, 41106', 'StrRetorno' => 'xml'); #debug(self::CORREIOS_SHIPPING_URL . '?' . http_build_query($data)); self::$request = new HttpHandler(self::CORREIOS_SHIPPING_URL); self::$request->setParams($data); self::$request->execute(); $response = json_decode(json_encode(simplexml_load_string(self::$request->getContent())), true); return $response; }