I am trying to write a simple php5 script to access to access the product search API, but I am getting the following error.
Warning: SoapClient::SoapClient(
https://api.cj.com/wsdl/version2/pro...ServiceV2.wsdl) [function.SoapClient-SoapClient]: failed to open stream: Connection timed out
I have PHP5 and SOAP is enabled on my server. Anybody has worked with the API. Any help will be appreciated.
The following is my code.
$key = "My Dev Key";
$siteId = "My
PID";
$wdslurl = 'https://api.
cj.com/wsdl/version2/productSearchServiceV2.wsdl';
$keywords = 'NBA Playoff tickets'; // What you want to search for.
try {
$productClient = new SoapClient($wdslurl,array('trace' => 1));
$results = $productClient->search(array(
"developerKey" => $key,
"websiteId" => $siteId,
"advertiserIds" => '',
"keywords" => "$keywords",
"serviceableArea" => '',
"upc" => '',
"manufacturerName" => '',
"manufacturerSku" => '',
"advertiserSku" => '',
"lowPrice" => '',
"highPrice" => '',
"lowSalePrice" => '',
"highSalePrice" => '',
"currency" => '',
"isbn" => '',
"sortBy" => '',
"sortOrder" => '',
"startAt" => 0,
"maxResults" => 10
)
);
print_r($results->out->totalResults);
// if something goes wrong show the user a nice message
} catch (Exception $e){
echo "
There was an error with your request or the service is unavailable.
";
print_r ($e);
}
?>