codigo de amazon web-services1 min read

No es el codigo del que este mas orgulloso, de hecho es urgente una pequena reingenieria, pero funciona y de hecho fue por hobbie, ademas de ser mi primer web-service.

Usando NuSOAP.


$GLOBAL_VARS = array("NUSOAP_PATH" => "../include/nusoap/",
"AMAZON_TAG" => "[SOLICITAR TOKEN]",
"AMAZON_WSDL" => "http://soap.amazon.com/schemas2/AmazonWebServices.wsdl");
class BookInfo
{
function BookInfo($isbn,$debug=false){
global $GLOBAL_VARS;
$this->debug = $debug;

$this->isbn = $isbn;
$this->authors = "";
$this->image = "";
$this->date = "";

$this->service = new soapclient($GLOBAL_VARS["AMAZON_WSDL"],true);
$this->proxy = $this->service->getproxy() or die("no proxy");

if($this->debug)
echo "servicios iniciados";

$this->getBookInfo();

}

function getBookInfo(){
global $GLOBAL_VARS;
$params = array(
"asin" => $this->isbn,
"tag" => "webservices-20",
"devtag" => $GLOBAL_VARS["AMAZON_TAG"],
"type" => "heavy",
"page" => 1,
);
if($this->debug)
echo "servicio solicitado";
$this->result = $this->_loadService('AsinSearchRequest',$params);
if($this->debug)
echo "paquete recivido";

}

function _loadService($serv, $params){
return $this->proxy->$serv($params);
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *