diff --git a/ati-ti/google-api.php b/ati-ti/google-api.php new file mode 100644 index 0000000..2919d15 --- /dev/null +++ b/ati-ti/google-api.php @@ -0,0 +1,42 @@ + + + + + + + + + +
+ + \ No newline at end of file diff --git a/ati-ti/rest.php b/ati-ti/rest.php new file mode 100644 index 0000000..4551aed --- /dev/null +++ b/ati-ti/rest.php @@ -0,0 +1,164 @@ +setPostFields($newQuote); + $post= 1; + } + // Delete + else if (isset($_POST['idQuoteDelete']) && (trim($_POST['idQuoteDelete']) != "")) + { + $id = $_POST['idQuoteDelete']; + $result = new HttpRequest("http://lecturer.ukdw.ac.id/yuan/labs/quotes/$id", HttpRequest::METH_DELETE); + $delete = 1; + } + // Update + else if (isset($_POST['idQuoteChange']) && (trim($_POST['idQuoteChange']) != "") && (trim($_POST['authorQuoteChange']) != "") && (trim($_POST['quoteChange']) != "")) + { + $id = $_POST['idQuoteChange']; + $author = $_POST['authorQuoteChange']; + $quote = $_POST['quoteChange']; + $result = new HttpRequest("http://lecturer.ukdw.ac.id/yuan/labs/quotes/", HttpRequest::METH_PUT); + $result->setPutData($id); + $result->setPutData($author); + $result->setPutData($quote); + $put = 1; + } + + if ($get) { + try { + $result->send(); + if ($result->getResponseCode() == 200) { + $xml = $result->getResponseBody(); + $xmlResult = simplexml_load_string($xml); + foreach($xmlResult->quote as $k=>$v) { + echo "ID : " . $v->id . "
";; + echo "Quote : " . $v->content . "
"; + echo "Author : " . $v->author . "
"; + echo "
"; + } + } + } + catch (HttpException $ex) { + echo $ex; + } + } + else if ($post){ + try { + $result->send(); + if ($result->getResponseCode() == 200) + echo "Quote berhasil ditambahkan"; + else + echo "Quote gagal ditambahkan"; + } + catch (HttpException $ex) { + echo $ex; + } + } + else if ($delete){ + try { + $result->send(); + if ($result->getResponseCode() == 200) + echo "Quote berhasil dihapus"; + else + echo "Quote gagal dihapus"; + } + catch (HttpException $ex) { + echo $ex; + } + } + else if ($put){ + try { + $result->send(); + if ($result->getResponseCode() == 200) + echo "Quote berhasil diupdate"; + else + echo "Quote gagal diupdate"; + } + catch (HttpException $ex) { + echo $ex; + } + } +} +else // Tidak ada proses submit, berarti tampilkan form +{ +?> + + +Contoh Akses Web Service Berbasis RESTful API + + +

Mencari Quote

+
+ Masukkan Keyword Quotes + + +
+ +
+ Masukkan Nomor ID quotes + + +
+ +
+ Masukkan Nama Pembuat quote + + +
+ +

Menambahkan Quote Baru

+
+ Masukkan Nama Author
+ Masukkan Quote Anda + +
+ +

Menghapus Quote

+
+ Masukkan ID Quote + +
+ +

Mengganti Quote

+
+ Masukkan ID Quote
+ Masukkan Nama Author Baru
+ Masukkan Quote Baru + +
+ + + diff --git a/ati-ti/soap.php b/ati-ti/soap.php new file mode 100644 index 0000000..aad104e --- /dev/null +++ b/ati-ti/soap.php @@ -0,0 +1,80 @@ +getBukuByJudul("$judul", 0); + } + else if (isset($_POST['pengarang']) && (trim($_POST['pengarang']) != "")) + { + $pengarang = $_POST['pengarang']; + $result = $client->getBukuByPengarang("$pengarang", 0); + } + else if (isset($_POST['penerbit']) && (trim($_POST['penerbit']) != "")) + { + $penerbit = $_POST['penerbit']; + $result = $client->getBukuByPenerbit("$penerbit", 0); + } + + // Proses array + foreach($result as $k=>$v) + { + print " + + + + + + + + + + + + + + + + + + + + +
No: " . ($k+1) . "
No. Ref: " . $v->norefb . "
Call Number: " . $v->callnumb . "
Pengarang " . $v->pengarang . "
Judul: " . $v->judul . "
Penerbit: " . $v->penerbit . "

"; + } + } +else // Tidak ada proses submit, berarti tampilkan form +{ +?> + + +Contoh Akses Web Service Perpustakaan UKDW Menggunakan SOAP + + +
+ Masukkan Judul Buku yang hendak Dicari? + + +
+ +
+ Masukkan nama pengarang buku hendak Dicari? + + +
+ +
+ Masukkan nama penerbit buku hendak Dicari? + + +
+ + +