try the code below :
$client = new SoapClient("https://technet.rapaport.com/WebServices/RetailFeed/Feed.asmx?WSDL", array( "trace" => 1, "exceptions" => 0, "cache_wsdl" => 0) ); $params = array("Username"=>"USERNAME", "Password"=>"PASSWORD"); $client->__soapCall("Login", array($params), NULL, NULL, $output_headers); $ticket = $output_headers["AuthenticationTicketHeader"]->Ticket; $client1 = new SoapClient("https://technet.rapaport.com/WebServices/RetailFeed/Feed.asmx?WSDL", array( "trace" => 1, "exceptions" => 0, "cache_wsdl" => 0) ); $ns = "http://technet.rapaport.com/"; $headerBody = array("Ticket" => $ticket); $header = new SoapHeader($ns, "AuthenticationTicketHeader", $headerBody); $client1->__setSoapHeaders($header); $searchParams = array( "ShapeCollection" => array("ROUND", "PEAR", "PRINCESS", "MARQUISE", "OVAL", "RADIANT", "EMERALD", "HEART", "CUSHION","ASSCHER"), "LabCollection" => array("GIA","IGI","HRD"), "PageNumber" => 1, "PageSize" => 10, "FluorescenceIntensities" => "Medium", "SortDirection" => "ASC", "SortBy" => "PRICE" ); $params1 = array("SearchParams" => $searchParams, "DiamondsFound" => 0); $client1->__soapCall("GetDiamonds", array($params1), NULL, NULL, $output_headers); $xmlObj = new DOMDocument(); $xmlObj->loadXML($client1->__getLastResponse()); foreach($xmlObj->getElementsByTagName("DiamondsFound") as $diamondFound){ echo ("Diamonds Found:".$diamondFound->nodeValue); echo "<br />"; echo "<br />"; } echo "<br />"; foreach($xmlObj->getElementsByTagName("Table1") as $table){ foreach($table->childNodes as $vals){ print ( $vals->nodeName." : ".$vals->nodeValue."<br/>"); } echo "<br />"; echo "<br />"; }
|