smsAPI($sms, Core::setting()->get('cssetti_id')); $odp = $shop[0]; $value = $shop[1]; switch ($odp){ case 1:{ return array($value, 'Konto zostało doładowane'); break; } case 2: { return array(0.0, 'Kod niepoprawny'); break; } case 3: { return array(0.0, 'Kod został juz wykożystany'); break; } case 4: { return array(0.0, 'Nie można nawiązać połączeni'); break; } } } /** * Stawki sms * * * @access public * @return array zwraca tablice ze stawkami sms(numer, koszt, tresc) */ public function rates() { $rates = array(); //Numer | koszt | do portfela trafi... $rates[] = array(71480, 1.23, 0.5); $rates[] = array(72480, 2.46, 1.0); $rates[] = array(73480, 3.69, 1.5); $rates[] = array(74480, 4.92, 2.0); $rates[] = array(75480, 6.15, 2.5); $rates[] = array(76480, 7.38, 3.0); $rates[] = array(79480, 11.07, 4.5); $rates[] = array(91400, 17.22, 7.0); $rates[] = array(91900, 23.37, 9.5); $rates[] = array(92550, 30.75, 12.5); $_return = array(); foreach($rates as $rate) { $_return[] = array( 'numer' => $rate[0], 'text_sms' => 'ag cssetti', 'cost' => $rate[1], 'amount' => $rate[2] ); } return $_return; } private function smsAPI($kod, $id){ $ch = curl_init(); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $ch, CURLOPT_POST, 1); curl_setopt( $ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 ); curl_setopt( $ch, CURLOPT_POSTFIELDS, array( 'kod' => $kod, 'id' => $id )); curl_setopt( $ch, CURLOPT_URL, "http://www.cssetti.pl/api.php"); $res = curl_exec($ch); curl_close($ch); $res = explode('|', $res); return $res; } } ?>