monde
12-27-2006, 09:39 AM
I attempted to use CJ's web services that rely on SOAP on Bluehost.
Since Bluehost does not enable SOAP, from another post, I know that the alternative is to include NuSOAP. However now I face a different error from the earlier one.
the output is this:
Fatal error: Call to undefined method soapclient::search() in /home/username/public_html/webtest/productSearch.php on line 64
Below is the script that provided by CJ. I added "require_once("../webtest/lib/nusoap.php");" so that nusoap will work.
where have I gone wrong? Thanks first.
<body>
<center>
<h2>Commission Junction Demo Product Search</h2>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="get">
<p><label for="keywords">Search for </label>
<input type="text" name="keywords" value="<?php echo $_GET['keywords'] ?>" >
<input type="submit" value="Continue →" /></p>
</form>
</center>
<hr>
<?php
require_once("../webtest/lib/nusoap.php");
?>
<?php
try {
// create a soap client using the Commission Junction WSDL
$ini = ini_set("soap.wsdl_cache_enabled","0");
$client = new SoapClient('productSearchService.wsdl', array('trace'=> true));
// call the service with the appropriate variables, remember developer key is required
$results = $client->search(
$developerKey = '3215456488987814655464',
$websiteId = '1234567',
$advertiserIds = '7654321',
$keywords = $_GET['keywords'],
$serviceableArea,
$upcOrIsbnOrEan,
$manufacturerName,
$advertiserSku,
$lowPrice,
$highPrice,
$currency,
$sortBy,
$orderIn,
$startAt = 0,
$maxResults = 10
);
// give the user a nice message about the results
print "<h3>Your search for '$keywords' generated $results->totalPossible results</h3>";
// iterate through the results and display them to the user
echo '<div id="results">';
foreach ($results->products as $product) {
// format the price so that it is consistant
$price = sprintf('%01.2f', $product->price);
echo "<a href='$product->clickUrl'><img src ='$product->imageUrl' height='70' ><p>$product->name <br/> Offered by $product->advertiserName at <b>$price ($product->currency)</b> </p></a>";
echo "<div style='clear:both'></div>";
}
echo '</div>';
// if something goes wrong show the user a nice message
} catch (Exception $e){
echo "<div id='error'><p>There was an error with your request or the service is unavailable.</p></div>";
// print_r ($e);
}
?>
</body>
Since Bluehost does not enable SOAP, from another post, I know that the alternative is to include NuSOAP. However now I face a different error from the earlier one.
the output is this:
Fatal error: Call to undefined method soapclient::search() in /home/username/public_html/webtest/productSearch.php on line 64
Below is the script that provided by CJ. I added "require_once("../webtest/lib/nusoap.php");" so that nusoap will work.
where have I gone wrong? Thanks first.
<body>
<center>
<h2>Commission Junction Demo Product Search</h2>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="get">
<p><label for="keywords">Search for </label>
<input type="text" name="keywords" value="<?php echo $_GET['keywords'] ?>" >
<input type="submit" value="Continue →" /></p>
</form>
</center>
<hr>
<?php
require_once("../webtest/lib/nusoap.php");
?>
<?php
try {
// create a soap client using the Commission Junction WSDL
$ini = ini_set("soap.wsdl_cache_enabled","0");
$client = new SoapClient('productSearchService.wsdl', array('trace'=> true));
// call the service with the appropriate variables, remember developer key is required
$results = $client->search(
$developerKey = '3215456488987814655464',
$websiteId = '1234567',
$advertiserIds = '7654321',
$keywords = $_GET['keywords'],
$serviceableArea,
$upcOrIsbnOrEan,
$manufacturerName,
$advertiserSku,
$lowPrice,
$highPrice,
$currency,
$sortBy,
$orderIn,
$startAt = 0,
$maxResults = 10
);
// give the user a nice message about the results
print "<h3>Your search for '$keywords' generated $results->totalPossible results</h3>";
// iterate through the results and display them to the user
echo '<div id="results">';
foreach ($results->products as $product) {
// format the price so that it is consistant
$price = sprintf('%01.2f', $product->price);
echo "<a href='$product->clickUrl'><img src ='$product->imageUrl' height='70' ><p>$product->name <br/> Offered by $product->advertiserName at <b>$price ($product->currency)</b> </p></a>";
echo "<div style='clear:both'></div>";
}
echo '</div>';
// if something goes wrong show the user a nice message
} catch (Exception $e){
echo "<div id='error'><p>There was an error with your request or the service is unavailable.</p></div>";
// print_r ($e);
}
?>
</body>