/** * @param TemelIstek $istek * * @return ListeCevap */ public static function get($istek) { /** @var Response $sonuc */ $sonuc = Request::post('http://www.camlicakitap.com/api/v2/kitap/liste', $istek->getArray())->sendsType('form')->expectsType('json')->send(); // yeni bir cevap oluşturalım $cevap = new ListeCevap($sonuc->body->sonuc); // sonucu kontrol edelim if ($cevap->isSonucBasarili()) { // kayıtları set edelim $cevap->setKayitlar($sonuc->body->kayitlar); } else { // mesajı set edelim $cevap->mesaj = $sonuc->body->mesaj; } // cevabı geri dönelim return $cevap; }
<?php require_once '../../vendor/autoload.php'; use CamlicaKitapApi\KategoriDetay; use CamlicaKitapApi\Model\TemelIstek; error_reporting(E_ALL); // hash bilgisini buraya yazınız. $hash = ''; $istek = new TemelIstek($hash); $istek->setKategoriId(1); try { $cevap = KategoriDetay::get($istek); echo '<pre>'; print_r($cevap); echo '</pre>'; } catch (Exception $ex) { die('hata: ' . $ex->getMessage()); }
<?php require_once '../../vendor/autoload.php'; use CamlicaKitapApi\KitapDetay; use CamlicaKitapApi\Model\TemelIstek; error_reporting(E_ALL); // hash bilgisini buraya yazınız. $hash = ''; $istek = new TemelIstek($hash); $istek->setKitapId(17); try { $cevap = KitapDetay::get($istek); echo '<pre>'; print_r($cevap); echo '</pre>'; } catch (Exception $ex) { die('hata: ' . $ex->getMessage()); }
<?php require_once '../../vendor/autoload.php'; use CamlicaKitapApi\Model\TemelIstek; use CamlicaKitapApi\YazarDetay; error_reporting(E_ALL); // hash bilgisini buraya yazınız. $hash = ''; $istek = new TemelIstek($hash); $istek->setYazarId(125); try { $cevap = YazarDetay::get($istek); echo '<pre>'; print_r($cevap); echo '</pre>'; } catch (Exception $ex) { die('hata: ' . $ex->getMessage()); }