PDA

View Full Version : Example source code in PHP for Product Search


zudvip
23-04-08, 10:20
HI,
Can anyone help with Product Search example code in PHP?
Thank.

IntroSites
23-04-08, 10:59
There is an example in the PHP API download

hth

zudvip
23-04-08, 13:03
Many thanks. I have found a code.

crounauer
03-07-08, 00:07
Hi zudvip,

Could you perhaps point me in the direction of some sample php code?

Thanks,
Simon

crounauer
04-07-08, 17:27
Hi,

Here is some php code that I have been using with compliments from authcode


define('API', 'PS');

require_once('classes/class.ClientFactory.php');

// replace with your own credentials
$oClient= ClientFactory::getClient(xxx, 'xxxxxx', 'affiliate');

$params3= array('sQuery'=>'canon digital', 'iLimit'=>9, 'iOffset'=>360, 'sMode'=>'boolean');

$response= $oClient->call('searchProduct', $params3);

print "<pre>";
$sOutput= '';
$sOutput.= $oClient->__getLastRequest();
$sOutput.= $oClient->__getLastResponse();
$sOutput= str_replace('><', ">\n<", $sOutput);
print $sOutput;

#loop through each array element
foreach($response->searchProductReturn as $product) {
#print the product name
echo $product->sName . '<br />';
}


This will print out the product name when searching for "canon digital"

Thanks,
Simon