REST strictly refers to a collection of architectural principles. The term is also often used in a loose sense to describe any simple interface that transmits domain-specific data over HTTP without an additional messaging layer such as SOAP or session tracking via HTTP cookies.
You will find below samples on how you can access the web services by using REST with the signed URL (see above).
We are also providing samples of XSL transformation of the requested XML.
One way to query the web service is to use the file_get_contents()
function:
function
get_url(
$url
)
{
$opts
=
array
(
'http'
=>
array
(
'method'
=>
"GET"
,
'header'
=>
"Accept-Encoding: gzip,deflate"
)
);
$context
= stream_context_create(
$opts
);
$content
=
file_get_contents
(
$url
,false,
$context
);
$content
= gzinflate(
substr
(
$content
,10,-8) );
return
$content
;
}
$url = UrlSigner('http://uk.shoppingapis.kelkoo.com', '/V3/productSearch?query=ipod', '123', 'PartnerKey'); $xml = get_url($url); echo $xml;
Unfortunately, this function is only available in PHP 4.3.0 and above. One other way to do this is to use cURL:
$url = UrlSigner('http://uk.shoppingapis.kelkoo.com', '/V3/productSearch?query=ipod', '123', 'PartnerKey');
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_ENCODING, '');
$xml = curl_exec($curl); curl_close($curl); echo $xml;