/** * Sends the form data to a remote URL * * @param string $strURL * @param array $arrArguements * @param string $strMethod * @return string Server response */ public function send($strURL, $arrArguements = array(), $strMethod = 'POST', $user = null, $password = null) { if (sizeof($this->arrErrors) == 0) { $rest = new RESTclient(); $this->strAnswer = $rest->request(array_merge($arrArguements, $this->arrData), $strURL, $strMethod, $user, $password); } return $this->strAnswer; }
$rest->createRequest($url, "POST", $inputs); $rest->sendRequest(); $output = $rest->getResponse(); echo '<h2>Update</h2>'; echo $output; $op = json_decode($output); prx($op); // End update // Read $url = "http://example.com/rest/user_list.json?id=" . $op->id; $rest = new RESTclient(); $rest->createRequest($url, "GET", array()); $rest->sendRequest(); $output = $rest->getResponse(); echo '<h2>Read</h2>'; echo $output; $op = json_decode($output); prx($op); // End Read // Delete $inputs['id'] = $op->records[0]->id; $url = "http://example.com/rest/user_delete.json"; $rest = new RESTclient(); $rest->createRequest($url, "POST", $inputs); $rest->sendRequest(); $output = $rest->getResponse(); echo '<h2>Delete</h2>'; echo $output; $op = json_decode($output); prx($op); // End Delete
<?php require_once "cliente/RESTClient.php"; $rest = new RESTclient(); $url = "http://localhost:8080/gosus-rest/rs/producto-service/productos"; $rest->createRequest("{$url}", "GET"); $rest->sendRequest(); $output = $rest->getResponse(); $lineas = round(count($output) / 3, 0); for ($i = 0; $i < $lineas; $i++) { ?> <tr> <td> <?php $j = 3 * $i; if ($output[$j] != null) { ?> <div class="simpleCart_shelfItem itemCarrito"> <h2 class="item_name"><?php echo $output[$j]["producto"]; ?> </h2> <div class="item-thumb "><img title="<?php echo $output[$j]["idProducto"]; ?> " src="images/cart/<?php echo $output[$j]["idProducto"]; ?> .jpg" /></div> <p><input type="text" value="1" class="item_Quantity" /><br/> <span class="item_price">S/<?php
<?php require_once "RESTclient.php"; require "config.php"; $photo_url = $_GET["photo_url"]; if (preg_match("#^http://(www.)?flickr.com/photos/([^/]+)/([^/]+)/?#", $photo_url, $matches)) { $photo_id = $matches[3]; $params = array('api_key' => $api_key, 'method' => 'flickr.photos.getInfo', 'photo_id' => $photo_id, 'format' => 'php_serial'); $rest = new RESTclient(); $url = "http://api.flickr.com/services/rest/"; $rest->createRequest("{$url}", "POST", $params); $rest->sendRequest(); $output = $rest->getResponse(); // echo $output; $rsp_obj = unserialize($output); // echo "<pre>";var_dump($rsp_obj);die(); // echo "<pre>";var_dump($_COOKIE);die(); $secret = $rsp_obj["photo"]["secret"]; $farm = $rsp_obj["photo"]["farm"]; $server = $rsp_obj["photo"]["server"]; $photo_info = array("id" => $photo_id, "secret" => $rsp_obj["photo"]["secret"], "farm" => $rsp_obj["photo"]["farm"], "server" => $rsp_obj["photo"]["server"], "owner" => $rsp_obj["photo"]["owner"]["username"], "nsid" => $rsp_obj["photo"]["owner"]["nsid"], "title" => $rsp_obj["photo"]["title"]["_content"]); $photo_links = array("s" => "http://farm{$farm}.static.flickr.com/{$server}/{$photo_id}_{$secret}_s.jpg", "t" => "http://farm{$farm}.static.flickr.com/{$server}/{$photo_id}_{$secret}_t.jpg", "m" => "http://farm{$farm}.static.flickr.com/{$server}/{$photo_id}_{$secret}_m.jpg", "n" => "http://farm{$farm}.static.flickr.com/{$server}/{$photo_id}_{$secret}.jpg"); // var_dump($photo_links); // var_dump($photo_info); if ($_COOKIE["size"]) { $default_size = $_COOKIE["size"]; } else { $default_size = "m"; } $include_title = $_COOKIE["title"] == "true"; $include_name = $_COOKIE["owner"] == "true"; } else {