emmfield
03-12-09, 15:34
I'm so annoyed with the Shopwindow/Productserve API. I've been working on it for 6 hours now and I'm completely stuck. I know this might be better off in the API section, but it's also a rant about the lack of documentation for beginners on getting a basic install up and running. All I've found is this (http://wiki.affiliatewindow.com/index.php/ProductServe_API_v3) and I don't get it.
I've followed this guide (http://www.awinapi.com/2009/06/29/the-first-example-get-list-of-merchants/). And my code looks like this:
<?php
$pageContents = <<< EOPAGE
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html lang="en" xml:lang="en">
<head>
<title>
AWin Test Page
</title>
<body>
<h1>Test Products</h1>
EOPAGE;
echo $pageContents;
echo "Hello World!";
define('API', 'PS');
require_once('constants.inc.php');
require_once('classes/class.ClientFactory.php');
$oClient = ClientFactory::getClient(API_USERNAME, API_PASSWORD, API_USER_TYPE);
$listmerchants = array('iCategoryId'=> 97, 'iMaxResult' => 10);
$oResponse = $oClient->call('getMerchantList', $listmerchants);
foreach($oResponse->oMerchant as $details){
$name = $details->sName;
$strapline = $details->sStrapline;
$description = $details->sDescription;
$logo = $details->sLogoUrl;
$showurl = $details->sDisplayUrl;
$deeplink = $details->sClickThroughUrl;
$id = $details->iId;
if ($logo<>'') {
echo "<a href=".$deeplink." title='".$name."'><img src=".$logo.
" style='float:left; margin:5px;' alt='".$name.
" :: ".$strapline." :: ".$description." :: ".$showurl.
"' width=\"88\" height=\"31\" border=\"0\"></a>";
}
}
?>
All I'm getting is:
Test Products
Hello World!
Warning: Invalid argument supplied for foreach() in (big long path...)/index.php on line 27
I'm good with HTML and CSS. I don't know any PHP. All I want to do is get it working then I should be able to tweak around myself. All the API files have been uploaded, and I've input my ID, API password and API key.
Please help!
I've followed this guide (http://www.awinapi.com/2009/06/29/the-first-example-get-list-of-merchants/). And my code looks like this:
<?php
$pageContents = <<< EOPAGE
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html lang="en" xml:lang="en">
<head>
<title>
AWin Test Page
</title>
<body>
<h1>Test Products</h1>
EOPAGE;
echo $pageContents;
echo "Hello World!";
define('API', 'PS');
require_once('constants.inc.php');
require_once('classes/class.ClientFactory.php');
$oClient = ClientFactory::getClient(API_USERNAME, API_PASSWORD, API_USER_TYPE);
$listmerchants = array('iCategoryId'=> 97, 'iMaxResult' => 10);
$oResponse = $oClient->call('getMerchantList', $listmerchants);
foreach($oResponse->oMerchant as $details){
$name = $details->sName;
$strapline = $details->sStrapline;
$description = $details->sDescription;
$logo = $details->sLogoUrl;
$showurl = $details->sDisplayUrl;
$deeplink = $details->sClickThroughUrl;
$id = $details->iId;
if ($logo<>'') {
echo "<a href=".$deeplink." title='".$name."'><img src=".$logo.
" style='float:left; margin:5px;' alt='".$name.
" :: ".$strapline." :: ".$description." :: ".$showurl.
"' width=\"88\" height=\"31\" border=\"0\"></a>";
}
}
?>
All I'm getting is:
Test Products
Hello World!
Warning: Invalid argument supplied for foreach() in (big long path...)/index.php on line 27
I'm good with HTML and CSS. I don't know any PHP. All I want to do is get it working then I should be able to tweak around myself. All the API files have been uploaded, and I've input my ID, API password and API key.
Please help!