Get single price from Web Service - with PHP


<?php
//use nusoap library: http://sourceforge.net/projects/nusoap/
//tested with php 5, nusoap version 0.9.5
require_once('lib/nusoap.php');

//NOTE: both parameters and values are case sensitve!

//prepare soap request to Rapaport:
$rap_soapUrl = "https://technet.rapaport.com/webservices/prices/rapaportprices.asmx?wsdl";
$soap_Client = new nusoap_client($rap_soapUrl, 'wsdl');
$rap_credentials['Username'] = "loginname";
$rap_credentials['Password'] = "mypassword";

//do login, and save authentication ticket for further use:
$result = $soap_Client->call('Login', $rap_credentials);
$rap_auth_ticket = $soap_Client->getHeaders();

//get price for single diamond
$paramsA["shape"] = "round";
$paramsA["size"] = "1.11";
$paramsA["color"] = "F";
$paramsA["clarity"] = "vs1";
$soap_Client->setHeaders($rap_auth_ticket);
$result = $soap_Client->call('GetPrice', $paramsA);
echo $result['GetPriceResult']['price'];

?>