Get data by parsing XML string

I am calling a web service that returns the following xml. I need to get the values returned for $Status and $StatusType using php. How can i do this.

xml code.....

<Status_id>5</Status_id>
<StatusUser_id>1</StatusUser_id>
<ApplicationEntryType_id>4</ApplicationEntryType_id>
<NoInitialDraw>false</NoInitialDraw>
<InProcess>false</InProcess>
<RequestedAmount>15000.0000</RequestedAmount>
<Dealer>Temp Dealer - AZ</Dealer>
<Model>Flooring</Model>
<Product>Flooring</Product>
<Status>Declined</Status>
<StatusType>4</StatusType>
<RequiresReview>false</RequiresReview>
<FinalStatus>true</FinalStatus>
<AllowOverride>false</AllowOverride>
<ApplicationComplete>true</ApplicationComplete>
<ApplicationProcessed>true</ApplicationProcessed>
<ManufacturerUniqueType>9</ManufacturerUniqueType>

more xml code...

LVL 1
pdheadyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ahalyaCommented:
use the function below.

$Status= CopyTaggedText($xml, 'Status');
$StatusType = CopyTaggedText($xml, 'StatusType');


function CopyTaggedText($src, $tag) {
 
  $open = '<'.$tag;
  $close= '</'.$tag .'>';
 
  $loc = stripos($src, $open);
  $offset = $loc + strlen($open); 
  $done = false;
  while (!($done)) {
      $o1 = stripos($src, $open,  $offset);
      $o2 = stripos($src, $close, $offset);
      $done = ($o1 === false) || ($o1 > $o2);       
      $offset = $o2 ;
  }
    
  $result = substr($src, $loc + strlen($open), $offset-strlen($open));    
  $loc = strpos($result, '>'); //start tag might have attributes, remove them !
  if ($loc !== false) $result = substr($result, $loc + 1);           
  return trim($result, "\x00..\x1F");
}

Open in new window

0
ahalyaCommented:
By the way, you can skip the following

  $done = false;
  while (!($done)) {
      $o1 = stripos($src, $open,  $offset);
      $o2 = stripos($src, $close, $offset);
      $done = ($o1 === false) || ($o1 > $o2);      
      $offset = $o2 ;
  }

if you know you tag is a simple one.  Those lines permit recursion to deal with tags within tags; (not needed for xml, but needed for html)

0
pdheadyAuthor Commented:
Thanks but I cant seem to get it to work. The echo is not even working after the function output.

This is what im doing.
$xml = htmlspecialchars($client->response, ENT_QUOTES); // get the xml data response
 
function CopyTaggedText($src, $tag) {
 
  $open = '<'.$tag;
  $close= '</'.$tag .'>';
 
  $loc = stripos($src, $open);
  $offset = $loc + strlen($open); 
    
  $result = substr($src, $loc + strlen($open), $offset-strlen($open));    
  $loc = strpos($result, '>'); //start tag might have attributes, remove them !
  if ($loc !== false) $result = substr($result, $loc + 1);           
  return trim($result, "\x00..\x1F");
}
 
 
$Status= CopyTaggedText($xml, 'Status');
$StatusType = CopyTaggedText($xml, 'StatusType');
 
 
}  
 
 
echo "status = $Status";
echo "status type = $StatusType";

Open in new window

0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Ray PaseurCommented:
Please post ALL of the XML code from top to bottom.  If we have it all, we can give you the parsing statements.  The excerpt is not sufficient to answer your query.  Thanks, ~Ray
0
pdheadyAuthor Commented:
Here it is.


HTTP/1.1 200 OK
Date: Tue, 28 Oct 2008 06:05:16 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 11580
 
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetApplicationResponse xmlns="CapsWebClient/WebServices/CreditApplication">
<GetApplicationResult>
<xs:schema id="dsApplication" targetNamespace="http://www.tempuri.org/dsApplication.xsd" xmlns:mstns="http://www.tempuri.org/dsApplication.xsd" xmlns="http://www.tempuri.org/dsApplication.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="dsApplication" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Application">
<xs:complexType>
<xs:sequence>
<xs:element name="Application_id" msdata:ReadOnly="true" msdata:AutoIncrement="true" type="xs:int" />
<xs:element name="Dealer_id" type="xs:int" />
<xs:element name="Model_id" type="xs:int" />
<xs:element name="ModelYear" type="xs:int" />
<xs:element name="Quantity" type="xs:int" />
<xs:element name="Status_id" type="xs:int" />
<xs:element name="PricingDetail_id" type="xs:int" minOccurs="0" />
<xs:element name="StatusUser_id" type="xs:int" minOccurs="0" />
<xs:element name="ApplicationEntryType_id" type="xs:int" />
<xs:element name="InvitationNumber" type="xs:string" minOccurs="0" />
<xs:element name="PricingDetailTerm_id" type="xs:int" minOccurs="0" />
<xs:element name="ActualBalance" type="xs:decimal" minOccurs="0" />
<xs:element name="ActualDownPayment" type="xs:decimal" minOccurs="0" />
<xs:element name="ActualInterestRate" type="xs:decimal" minOccurs="0" />
<xs:element name="ActualTerm" type="xs:int" minOccurs="0" />
<xs:element name="ActualModel_id" type="xs:int" minOccurs="0" />
<xs:element name="ActualPaymentAmount" type="xs:decimal" minOccurs="0" />
<xs:element name="ActualContractDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="ActualFirstPaymentDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="ActualMaturityDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="ActualFinanceCharge" type="xs:decimal" minOccurs="0" />
<xs:element name="VerifiedDealerNumber" type="xs:string" minOccurs="0" />
<xs:element name="VIN" type="xs:string" minOccurs="0" />
<xs:element name="VIN2" type="xs:string" minOccurs="0" />
<xs:element name="NoInitialDraw" type="xs:boolean" minOccurs="0" />
<xs:element name="InProcess" type="xs:boolean" minOccurs="0" />
<xs:element name="RequestedAmount" type="xs:decimal" minOccurs="0" />
<xs:element name="ApplicationPricing_id" type="xs:int" minOccurs="0" />
<xs:element name="Dealer" type="xs:string" />
<xs:element name="Model" type="xs:string" />
<xs:element name="Product" type="xs:string" />
<xs:element name="Status" type="xs:string" />
<xs:element name="StatusType" type="xs:int" />
<xs:element name="RequiresReview" type="xs:boolean" />
<xs:element name="FinalStatus" type="xs:boolean" />
<xs:element name="AllowOverride" type="xs:boolean" />
<xs:element name="ApplicationComplete" type="xs:boolean" />
<xs:element name="ApplicationProcessed" type="xs:boolean" />
<xs:element name="ManufacturerUniqueType" type="xs:int" />
<xs:element name="Product_id" type="xs:int" />
<xs:element name="EntryType" type="xs:string" />
<xs:element name="LastPricingDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="ActualModelOverride" type="xs:string" minOccurs="0" />
<xs:element name="ActualSalesPrice" type="xs:decimal" minOccurs="0" />
<xs:element name="ActualWarrantyFees" type="xs:decimal" minOccurs="0" />
<xs:element name="ActualDocFees" type="xs:decimal" minOccurs="0" />
<xs:element name="ActualFees" type="xs:decimal" minOccurs="0" />
<xs:element name="ActualTradeIn" type="xs:decimal" minOccurs="0" />
<xs:element name="VIN3" type="xs:string" minOccurs="0" />
<xs:element name="VIN4" type="xs:string" minOccurs="0" />
<xs:element name="OverrideFundingRate" type="xs:decimal" minOccurs="0" />
<xs:element name="DirectDeposit" type="xs:boolean" minOccurs="0" />
<xs:element name="BankRoutingNumber" type="xs:string" minOccurs="0" />
<xs:element name="BankAccountNumber" type="xs:string" minOccurs="0" />
<xs:element name="BankAccountType" type="xs:int" minOccurs="0" />
<xs:element name="CounterAA1" type="xs:string" minOccurs="0" />
<xs:element name="CounterAA2" type="xs:string" minOccurs="0" />
<xs:element name="CounterAA3" type="xs:string" minOccurs="0" />
<xs:element name="CounterAA4" type="xs:string" minOccurs="0" />
<xs:element name="Flagged" type="xs:boolean" />
<xs:element name="DocumentsOnly" type="xs:boolean" />
<xs:element name="AllowInitialDraw" type="xs:boolean" />
<xs:element name="AllowManualUnderwriting" type="xs:boolean" />
<xs:element name="Manufacturer_id" type="xs:int" />
<xs:element name="ManufacturerType" type="xs:int" />
<xs:element name="ANIPhoneNumber" type="xs:string" minOccurs="0" />
<xs:element name="TransactionFee" type="xs:boolean" minOccurs="0" />
<xs:element name="ConfirmationNumber" type="xs:string" minOccurs="0" />
<xs:element name="PrimaryApplicant" type="xs:string" minOccurs="0" />
<xs:element name="InitialDrawCannotExceedCreditLimit" type="xs:boolean" />
<xs:element name="InternetSourceKey" type="xs:string" minOccurs="0" />
<xs:element name="TermsAccepted" type="xs:boolean" minOccurs="0" />
<xs:element name="VerificationQuestion" type="xs:string" minOccurs="0" />
<xs:element name="VerificationAnswer" type="xs:string" minOccurs="0" />
<xs:element name="PriorDuplicateApplication_id" type="xs:int" minOccurs="0" />
<xs:element name="CreativeIndicator" type="xs:string" minOccurs="0" />
<xs:element name="Expired" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="ExpirationDate" msdata:ReadOnly="true" type="xs:dateTime" minOccurs="0" />
<xs:element name="CreativeIndicatorText" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
<xs:element name="EntryTypeType" type="xs:int" />
<xs:element name="TransactionFeeWaived" type="xs:boolean" minOccurs="0" />
<xs:element name="ShowWaiveFeeLink" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowPriceManually" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowViewPricing" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowCreditLineOverride" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowCloseFlags" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowValidation" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowDocumentsOnDemand" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowCreditTerms" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowInventory" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowSendToMU" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowEditFundingRate" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowIncompleteLetter" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowChangeStatus" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowEdit" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowProcessing" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowRedecision" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowPrintDocument" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="CanViewDealer" type="xs:boolean" />
<xs:element name="CanViewDecisionLetter" type="xs:boolean" />
<xs:element name="CanViewIncompleteLetter" type="xs:boolean" />
<xs:element name="CanViewExpiredLetter" type="xs:boolean" />
<xs:element name="CanViewOptInOut" type="xs:boolean" />
<xs:element name="DealerEmail" type="xs:string" minOccurs="0" />
<xs:element name="DealerFax" type="xs:string" minOccurs="0" />
<xs:element name="SalesPerson" type="xs:string" minOccurs="0" />
<xs:element name="ContractNumber" type="xs:string" minOccurs="0" />
<xs:element name="HasCreditPulls" type="xs:boolean" minOccurs="0" />
<xs:element name="RequireNoteOnStatusChange" type="xs:boolean" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="spv_GetApplicationAlerts">
<xs:complexType>
<xs:sequence>
<xs:element name="AlertText" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<dsApplication xmlns="http://www.tempuri.org/dsApplication.xsd">
<Application diffgr:id="Application1" msdata:rowOrder="0">
<Application_id>28921</Application_id>
<Dealer_id>2431</Dealer_id>
<Model_id>1898</Model_id>
<ModelYear>2008</ModelYear>
<Quantity>1</Quantity>
<Status_id>5</Status_id>
<StatusUser_id>1</StatusUser_id>
<ApplicationEntryType_id>4</ApplicationEntryType_id>
<NoInitialDraw>false</NoInitialDraw>
<InProcess>false</InProcess>
<RequestedAmount>15000.0000</RequestedAmount>
<Dealer>Temp Dealer - AZ</Dealer>
<Model>Flooring</Model>
<Product>Flooring</Product>
<Status>Declined</Status>
<StatusType>4</StatusType>
<RequiresReview>false</RequiresReview>
<FinalStatus>true</FinalStatus>
<AllowOverride>false</AllowOverride>
<ApplicationComplete>true</ApplicationComplete>
<ApplicationProcessed>true</ApplicationProcessed>
<ManufacturerUniqueType>9</ManufacturerUniqueType>
<Product_id>93</Product_id>
<EntryType>Internet</EntryType>
<Flagged>false</Flagged>
<DocumentsOnly>false</DocumentsOnly>
<AllowInitialDraw>false</AllowInitialDraw>
<AllowManualUnderwriting>false</AllowManualUnderwriting>
<Manufacturer_id>15</Manufacturer_id>
<ManufacturerType>0</ManufacturerType>
<TransactionFee>false</TransactionFee>
<PrimaryApplicant>Anthony D Thompson</PrimaryApplicant>
<InitialDrawCannotExceedCreditLimit>false</InitialDrawCannotExceedCreditLimit>
<Expired>false</Expired>
<ExpirationDate>4746-04-18T08:25:28.6230000-07:00</ExpirationDate>
<EntryTypeType>3</EntryTypeType>
<TransactionFeeWaived>false</TransactionFeeWaived>
<ShowWaiveFeeLink>false</ShowWaiveFeeLink>
<AllowPriceManually>false</AllowPriceManually>
<AllowViewPricing>false</AllowViewPricing>
<AllowCreditLineOverride>true</AllowCreditLineOverride>
<AllowCloseFlags>false</AllowCloseFlags>
<AllowValidation>false</AllowValidation>
<AllowDocumentsOnDemand>false</AllowDocumentsOnDemand>
<AllowCreditTerms>false</AllowCreditTerms>
<AllowInventory>false</AllowInventory>
<AllowSendToMU>false</AllowSendToMU>
<AllowEditFundingRate>false</AllowEditFundingRate>
<AllowIncompleteLetter>false</AllowIncompleteLetter>
<AllowChangeStatus>true</AllowChangeStatus>
<AllowEdit>false</AllowEdit>
<AllowProcessing>false</AllowProcessing>
<AllowRedecision>false</AllowRedecision>
<AllowPrintDocument>true</AllowPrintDocument>
<CanViewDealer>true</CanViewDealer>
<CanViewDecisionLetter>true</CanViewDecisionLetter>
<CanViewIncompleteLetter>false</CanViewIncompleteLetter>
<CanViewExpiredLetter>false</CanViewExpiredLetter>
<CanViewOptInOut>false</CanViewOptInOut>
<DealerFax>8124591234</DealerFax>
<HasCreditPulls>true</HasCreditPulls>
<RequireNoteOnStatusChange>false</RequireNoteOnStatusChange>
</Application>
<spv_GetApplicationAlerts diffgr:id="spv_GetApplicationAlerts1" msdata:rowOrder="0">
<AlertText>Dealer inactive for funding</AlertText>
</spv_GetApplicationAlerts>
</dsApplication>
</diffgr:diffgram>
</GetApplicationResult>
</GetApplicationResponse>
</soap:Body>
</soap:Envelope>

Open in new window

0
Ray PaseurCommented:
Thanks.  Man Page Here: http://us.php.net/manual/en/function.simplexml-load-string.php
<?php // RAY_xmltest.php
 
// THIS XML WILL NOT LOAD WITH simplexml_load_data() MAYBE IT IS NOT VALID XML?
$xmldata = '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetApplicationResponse xmlns="CapsWebClient/WebServices/CreditApplication">
<GetApplicationResult>
<xs:schema id="dsApplication" targetNamespace="http://www.tempuri.org/dsApplication.xsd" xmlns:mstns="http://www.tempuri.org/dsApplication.xsd" xmlns="http://www.tempuri.org/dsApplication.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="dsApplication" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Application">
<xs:complexType>
<xs:sequence>
<xs:element name="Application_id" msdata:ReadOnly="true" msdata:AutoIncrement="true" type="xs:int" />
<xs:element name="Dealer_id" type="xs:int" />
<xs:element name="Model_id" type="xs:int" />
<xs:element name="ModelYear" type="xs:int" />
<xs:element name="Quantity" type="xs:int" />
<xs:element name="Status_id" type="xs:int" />
<xs:element name="PricingDetail_id" type="xs:int" minOccurs="0" />
<xs:element name="StatusUser_id" type="xs:int" minOccurs="0" />
<xs:element name="ApplicationEntryType_id" type="xs:int" />
<xs:element name="InvitationNumber" type="xs:string" minOccurs="0" />
<xs:element name="PricingDetailTerm_id" type="xs:int" minOccurs="0" />
<xs:element name="ActualBalance" type="xs:decimal" minOccurs="0" />
<xs:element name="ActualDownPayment" type="xs:decimal" minOccurs="0" />
<xs:element name="ActualInterestRate" type="xs:decimal" minOccurs="0" />
<xs:element name="ActualTerm" type="xs:int" minOccurs="0" />
<xs:element name="ActualModel_id" type="xs:int" minOccurs="0" />
<xs:element name="ActualPaymentAmount" type="xs:decimal" minOccurs="0" />
<xs:element name="ActualContractDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="ActualFirstPaymentDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="ActualMaturityDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="ActualFinanceCharge" type="xs:decimal" minOccurs="0" />
<xs:element name="VerifiedDealerNumber" type="xs:string" minOccurs="0" />
<xs:element name="VIN" type="xs:string" minOccurs="0" />
<xs:element name="VIN2" type="xs:string" minOccurs="0" />
<xs:element name="NoInitialDraw" type="xs:boolean" minOccurs="0" />
<xs:element name="InProcess" type="xs:boolean" minOccurs="0" />
<xs:element name="RequestedAmount" type="xs:decimal" minOccurs="0" />
<xs:element name="ApplicationPricing_id" type="xs:int" minOccurs="0" />
<xs:element name="Dealer" type="xs:string" />
<xs:element name="Model" type="xs:string" />
<xs:element name="Product" type="xs:string" />
<xs:element name="Status" type="xs:string" />
<xs:element name="StatusType" type="xs:int" />
<xs:element name="RequiresReview" type="xs:boolean" />
<xs:element name="FinalStatus" type="xs:boolean" />
<xs:element name="AllowOverride" type="xs:boolean" />
<xs:element name="ApplicationComplete" type="xs:boolean" />
<xs:element name="ApplicationProcessed" type="xs:boolean" />
<xs:element name="ManufacturerUniqueType" type="xs:int" />
<xs:element name="Product_id" type="xs:int" />
<xs:element name="EntryType" type="xs:string" />
<xs:element name="LastPricingDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="ActualModelOverride" type="xs:string" minOccurs="0" />
<xs:element name="ActualSalesPrice" type="xs:decimal" minOccurs="0" />
<xs:element name="ActualWarrantyFees" type="xs:decimal" minOccurs="0" />
<xs:element name="ActualDocFees" type="xs:decimal" minOccurs="0" />
<xs:element name="ActualFees" type="xs:decimal" minOccurs="0" />
<xs:element name="ActualTradeIn" type="xs:decimal" minOccurs="0" />
<xs:element name="VIN3" type="xs:string" minOccurs="0" />
<xs:element name="VIN4" type="xs:string" minOccurs="0" />
<xs:element name="OverrideFundingRate" type="xs:decimal" minOccurs="0" />
<xs:element name="DirectDeposit" type="xs:boolean" minOccurs="0" />
<xs:element name="BankRoutingNumber" type="xs:string" minOccurs="0" />
<xs:element name="BankAccountNumber" type="xs:string" minOccurs="0" />
<xs:element name="BankAccountType" type="xs:int" minOccurs="0" />
<xs:element name="CounterAA1" type="xs:string" minOccurs="0" />
<xs:element name="CounterAA2" type="xs:string" minOccurs="0" />
<xs:element name="CounterAA3" type="xs:string" minOccurs="0" />
<xs:element name="CounterAA4" type="xs:string" minOccurs="0" />
<xs:element name="Flagged" type="xs:boolean" />
<xs:element name="DocumentsOnly" type="xs:boolean" />
<xs:element name="AllowInitialDraw" type="xs:boolean" />
<xs:element name="AllowManualUnderwriting" type="xs:boolean" />
<xs:element name="Manufacturer_id" type="xs:int" />
<xs:element name="ManufacturerType" type="xs:int" />
<xs:element name="ANIPhoneNumber" type="xs:string" minOccurs="0" />
<xs:element name="TransactionFee" type="xs:boolean" minOccurs="0" />
<xs:element name="ConfirmationNumber" type="xs:string" minOccurs="0" />
<xs:element name="PrimaryApplicant" type="xs:string" minOccurs="0" />
<xs:element name="InitialDrawCannotExceedCreditLimit" type="xs:boolean" />
<xs:element name="InternetSourceKey" type="xs:string" minOccurs="0" />
<xs:element name="TermsAccepted" type="xs:boolean" minOccurs="0" />
<xs:element name="VerificationQuestion" type="xs:string" minOccurs="0" />
<xs:element name="VerificationAnswer" type="xs:string" minOccurs="0" />
<xs:element name="PriorDuplicateApplication_id" type="xs:int" minOccurs="0" />
<xs:element name="CreativeIndicator" type="xs:string" minOccurs="0" />
<xs:element name="Expired" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="ExpirationDate" msdata:ReadOnly="true" type="xs:dateTime" minOccurs="0" />
<xs:element name="CreativeIndicatorText" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
<xs:element name="EntryTypeType" type="xs:int" />
<xs:element name="TransactionFeeWaived" type="xs:boolean" minOccurs="0" />
<xs:element name="ShowWaiveFeeLink" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowPriceManually" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowViewPricing" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowCreditLineOverride" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowCloseFlags" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowValidation" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowDocumentsOnDemand" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowCreditTerms" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowInventory" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowSendToMU" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowEditFundingRate" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowIncompleteLetter" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowChangeStatus" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowEdit" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowProcessing" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowRedecision" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowPrintDocument" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" />
<xs:element name="CanViewDealer" type="xs:boolean" />
<xs:element name="CanViewDecisionLetter" type="xs:boolean" />
<xs:element name="CanViewIncompleteLetter" type="xs:boolean" />
<xs:element name="CanViewExpiredLetter" type="xs:boolean" />
<xs:element name="CanViewOptInOut" type="xs:boolean" />
<xs:element name="DealerEmail" type="xs:string" minOccurs="0" />
<xs:element name="DealerFax" type="xs:string" minOccurs="0" />
<xs:element name="SalesPerson" type="xs:string" minOccurs="0" />
<xs:element name="ContractNumber" type="xs:string" minOccurs="0" />
<xs:element name="HasCreditPulls" type="xs:boolean" minOccurs="0" />
<xs:element name="RequireNoteOnStatusChange" type="xs:boolean" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="spv_GetApplicationAlerts">
<xs:complexType>
<xs:sequence>
<xs:element name="AlertText" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<dsApplication xmlns="http://www.tempuri.org/dsApplication.xsd">
<Application diffgr:id="Application1" msdata:rowOrder="0">
<Application_id>28921</Application_id>
<Dealer_id>2431</Dealer_id>
<Model_id>1898</Model_id>
<ModelYear>2008</ModelYear>
<Quantity>1</Quantity>
<Status_id>5</Status_id>
<StatusUser_id>1</StatusUser_id>
<ApplicationEntryType_id>4</ApplicationEntryType_id>
<NoInitialDraw>false</NoInitialDraw>
<InProcess>false</InProcess>
<RequestedAmount>15000.0000</RequestedAmount>
<Dealer>Temp Dealer - AZ</Dealer>
<Model>Flooring</Model>
<Product>Flooring</Product>
<Status>Declined</Status>
<StatusType>4</StatusType>
<RequiresReview>false</RequiresReview>
<FinalStatus>true</FinalStatus>
<AllowOverride>false</AllowOverride>
<ApplicationComplete>true</ApplicationComplete>
<ApplicationProcessed>true</ApplicationProcessed>
<ManufacturerUniqueType>9</ManufacturerUniqueType>
<Product_id>93</Product_id>
<EntryType>Internet</EntryType>
<Flagged>false</Flagged>
<DocumentsOnly>false</DocumentsOnly>
<AllowInitialDraw>false</AllowInitialDraw>
<AllowManualUnderwriting>false</AllowManualUnderwriting>
<Manufacturer_id>15</Manufacturer_id>
<ManufacturerType>0</ManufacturerType>
<TransactionFee>false</TransactionFee>
<PrimaryApplicant>Anthony D Thompson</PrimaryApplicant>
<InitialDrawCannotExceedCreditLimit>false</InitialDrawCannotExceedCreditLimit>
<Expired>false</Expired>
<ExpirationDate>4746-04-18T08:25:28.6230000-07:00</ExpirationDate>
<EntryTypeType>3</EntryTypeType>
<TransactionFeeWaived>false</TransactionFeeWaived>
<ShowWaiveFeeLink>false</ShowWaiveFeeLink>
<AllowPriceManually>false</AllowPriceManually>
<AllowViewPricing>false</AllowViewPricing>
<AllowCreditLineOverride>true</AllowCreditLineOverride>
<AllowCloseFlags>false</AllowCloseFlags>
<AllowValidation>false</AllowValidation>
<AllowDocumentsOnDemand>false</AllowDocumentsOnDemand>
<AllowCreditTerms>false</AllowCreditTerms>
<AllowInventory>false</AllowInventory>
<AllowSendToMU>false</AllowSendToMU>
<AllowEditFundingRate>false</AllowEditFundingRate>
<AllowIncompleteLetter>false</AllowIncompleteLetter>
<AllowChangeStatus>true</AllowChangeStatus>
<AllowEdit>false</AllowEdit>
<AllowProcessing>false</AllowProcessing>
<AllowRedecision>false</AllowRedecision>
<AllowPrintDocument>true</AllowPrintDocument>
<CanViewDealer>true</CanViewDealer>
<CanViewDecisionLetter>true</CanViewDecisionLetter>
<CanViewIncompleteLetter>false</CanViewIncompleteLetter>
<CanViewExpiredLetter>false</CanViewExpiredLetter>
<CanViewOptInOut>false</CanViewOptInOut>
<DealerFax>8124591234</DealerFax>
<HasCreditPulls>true</HasCreditPulls>
<RequireNoteOnStatusChange>false</RequireNoteOnStatusChange>
</Application>
<spv_GetApplicationAlerts diffgr:id="spv_GetApplicationAlerts1" msdata:rowOrder="0">
<AlertText>Dealer inactive for funding</AlertText>
</spv_GetApplicationAlerts>
</dsApplication>
</diffgr:diffgram>
</GetApplicationResult>
</GetApplicationResponse>
</soap:Body>
</soap:Envelope>';
 
if (!$xmlobject = simplexml_load_string($xmldata)) { echo "<br />XML Data Failed \n"; }
 
 
 
 
 
 
// THIS XML OMITS THE SOAP AND GETS RIGHT TO THE VALID XML
$xmldata = '<?xml version="1.0" encoding="utf-8"?>
<Application diffgr:id="Application1" msdata:rowOrder="0">
<Application_id>28921</Application_id>
<Dealer_id>2431</Dealer_id>
<Model_id>1898</Model_id>
<ModelYear>2008</ModelYear>
<Quantity>1</Quantity>
<Status_id>5</Status_id>
<StatusUser_id>1</StatusUser_id>
<ApplicationEntryType_id>4</ApplicationEntryType_id>
<NoInitialDraw>false</NoInitialDraw>
<InProcess>false</InProcess>
<RequestedAmount>15000.0000</RequestedAmount>
<Dealer>Temp Dealer - AZ</Dealer>
<Model>Flooring</Model>
<Product>Flooring</Product>
<Status>Declined</Status>
<StatusType>4</StatusType>
<RequiresReview>false</RequiresReview>
<FinalStatus>true</FinalStatus>
<AllowOverride>false</AllowOverride>
<ApplicationComplete>true</ApplicationComplete>
<ApplicationProcessed>true</ApplicationProcessed>
<ManufacturerUniqueType>9</ManufacturerUniqueType>
<Product_id>93</Product_id>
<EntryType>Internet</EntryType>
<Flagged>false</Flagged>
<DocumentsOnly>false</DocumentsOnly>
<AllowInitialDraw>false</AllowInitialDraw>
<AllowManualUnderwriting>false</AllowManualUnderwriting>
<Manufacturer_id>15</Manufacturer_id>
<ManufacturerType>0</ManufacturerType>
<TransactionFee>false</TransactionFee>
<PrimaryApplicant>Anthony D Thompson</PrimaryApplicant>
<InitialDrawCannotExceedCreditLimit>false</InitialDrawCannotExceedCreditLimit>
<Expired>false</Expired>
<ExpirationDate>4746-04-18T08:25:28.6230000-07:00</ExpirationDate>
<EntryTypeType>3</EntryTypeType>
<TransactionFeeWaived>false</TransactionFeeWaived>
<ShowWaiveFeeLink>false</ShowWaiveFeeLink>
<AllowPriceManually>false</AllowPriceManually>
<AllowViewPricing>false</AllowViewPricing>
<AllowCreditLineOverride>true</AllowCreditLineOverride>
<AllowCloseFlags>false</AllowCloseFlags>
<AllowValidation>false</AllowValidation>
<AllowDocumentsOnDemand>false</AllowDocumentsOnDemand>
<AllowCreditTerms>false</AllowCreditTerms>
<AllowInventory>false</AllowInventory>
<AllowSendToMU>false</AllowSendToMU>
<AllowEditFundingRate>false</AllowEditFundingRate>
<AllowIncompleteLetter>false</AllowIncompleteLetter>
<AllowChangeStatus>true</AllowChangeStatus>
<AllowEdit>false</AllowEdit>
<AllowProcessing>false</AllowProcessing>
<AllowRedecision>false</AllowRedecision>
<AllowPrintDocument>true</AllowPrintDocument>
<CanViewDealer>true</CanViewDealer>
<CanViewDecisionLetter>true</CanViewDecisionLetter>
<CanViewIncompleteLetter>false</CanViewIncompleteLetter>
<CanViewExpiredLetter>false</CanViewExpiredLetter>
<CanViewOptInOut>false</CanViewOptInOut>
<DealerFax>8124591234</DealerFax>
<HasCreditPulls>true</HasCreditPulls>
<RequireNoteOnStatusChange>false</RequireNoteOnStatusChange>
</Application>';
 
 
if ($xmlobject = simplexml_load_string($xmldata)) { echo "<br />XML Data Succeeded \n"; }
 
 
$status     = $xmlobject->Status;
$statustype = $xmlobject->StatusType;
 
echo "<br />Status: $status \n";
echo "<br />StatusType: $statustype \n";
 
echo "<pre>";
var_dump($xmlobject);
echo "</pre>";
 
 
?>

Open in new window

0
pdheadyAuthor Commented:
Thanks but i cant get it to work. Not getting any output.
0
Ray PaseurCommented:
Send me a link to where you posted the script.

Email RPaseur at NationalPres dot org

Thanks
0
pdheadyAuthor Commented:
I would but it's behind a protected network. Basically, I call an xml web-service and the response sent back is included below. I have to somehow get the values for Status and StatusType in the string sent back. Technically, this string sent back is not valid XML because of the HTTP headers. Normall I just do this and I get my values I need but does not work for this xml response because it is a multidimensional array?

$result = $client->call('GetApplication', $params, $namespace, $soapaction, $headers);

  foreach ($result as $key => $val) {
  ${$key}=$val;
  echo "\$$key=${$key}<br>";
  }
HTTP/1.1 200 OK Date: Tue, 28 Oct 2008 17:18:42 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 1.1.4322 Cache-Control: private, max-age=0 Content-Type: text/xml; charset=utf-8 Content-Length: 11580 <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetApplicationResponse xmlns="CapsWebClient/WebServices/CreditApplication"><GetApplicationResult><xs:schema id="dsApplication" targetNamespace="http://www.tempuri.org/dsApplication.xsd" xmlns:mstns="http://www.tempuri.org/dsApplication.xsd" xmlns="http://www.tempuri.org/dsApplication.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified"><xs:element name="dsApplication" msdata:IsDataSet="true"><xs:complexType><xs:choice maxOccurs="unbounded"><xs:element name="Application"><xs:complexType><xs:sequence><xs:element name="Application_id" msdata:ReadOnly="true" msdata:AutoIncrement="true" type="xs:int" /><xs:element name="Dealer_id" type="xs:int" /><xs:element name="Model_id" type="xs:int" /><xs:element name="ModelYear" type="xs:int" /><xs:element name="Quantity" type="xs:int" /><xs:element name="Status_id" type="xs:int" /><xs:element name="PricingDetail_id" type="xs:int" minOccurs="0" /><xs:element name="StatusUser_id" type="xs:int" minOccurs="0" /><xs:element name="ApplicationEntryType_id" type="xs:int" /><xs:element name="InvitationNumber" type="xs:string" minOccurs="0" /><xs:element name="PricingDetailTerm_id" type="xs:int" minOccurs="0" /><xs:element name="ActualBalance" type="xs:decimal" minOccurs="0" /><xs:element name="ActualDownPayment" type="xs:decimal" minOccurs="0" /><xs:element name="ActualInterestRate" type="xs:decimal" minOccurs="0" /><xs:element name="ActualTerm" type="xs:int" minOccurs="0" /><xs:element name="ActualModel_id" type="xs:int" minOccurs="0" /><xs:element name="ActualPaymentAmount" type="xs:decimal" minOccurs="0" /><xs:element name="ActualContractDate" type="xs:dateTime" minOccurs="0" /><xs:element name="ActualFirstPaymentDate" type="xs:dateTime" minOccurs="0" /><xs:element name="ActualMaturityDate" type="xs:dateTime" minOccurs="0" /><xs:element name="ActualFinanceCharge" type="xs:decimal" minOccurs="0" /><xs:element name="VerifiedDealerNumber" type="xs:string" minOccurs="0" /><xs:element name="VIN" type="xs:string" minOccurs="0" /><xs:element name="VIN2" type="xs:string" minOccurs="0" /><xs:element name="NoInitialDraw" type="xs:boolean" minOccurs="0" /><xs:element name="InProcess" type="xs:boolean" minOccurs="0" /><xs:element name="RequestedAmount" type="xs:decimal" minOccurs="0" /><xs:element name="ApplicationPricing_id" type="xs:int" minOccurs="0" /><xs:element name="Dealer" type="xs:string" /><xs:element name="Model" type="xs:string" /><xs:element name="Product" type="xs:string" /><xs:element name="Status" type="xs:string" /><xs:element name="StatusType" type="xs:int" /><xs:element name="RequiresReview" type="xs:boolean" /><xs:element name="FinalStatus" type="xs:boolean" /><xs:element name="AllowOverride" type="xs:boolean" /><xs:element name="ApplicationComplete" type="xs:boolean" /><xs:element name="ApplicationProcessed" type="xs:boolean" /><xs:element name="ManufacturerUniqueType" type="xs:int" /><xs:element name="Product_id" type="xs:int" /><xs:element name="EntryType" type="xs:string" /><xs:element name="LastPricingDate" type="xs:dateTime" minOccurs="0" /><xs:element name="ActualModelOverride" type="xs:string" minOccurs="0" /><xs:element name="ActualSalesPrice" type="xs:decimal" minOccurs="0" /><xs:element name="ActualWarrantyFees" type="xs:decimal" minOccurs="0" /><xs:element name="ActualDocFees" type="xs:decimal" minOccurs="0" /><xs:element name="ActualFees" type="xs:decimal" minOccurs="0" /><xs:element name="ActualTradeIn" type="xs:decimal" minOccurs="0" /><xs:element name="VIN3" type="xs:string" minOccurs="0" /><xs:element name="VIN4" type="xs:string" minOccurs="0" /><xs:element name="OverrideFundingRate" type="xs:decimal" minOccurs="0" /><xs:element name="DirectDeposit" type="xs:boolean" minOccurs="0" /><xs:element name="BankRoutingNumber" type="xs:string" minOccurs="0" /><xs:element name="BankAccountNumber" type="xs:string" minOccurs="0" /><xs:element name="BankAccountType" type="xs:int" minOccurs="0" /><xs:element name="CounterAA1" type="xs:string" minOccurs="0" /><xs:element name="CounterAA2" type="xs:string" minOccurs="0" /><xs:element name="CounterAA3" type="xs:string" minOccurs="0" /><xs:element name="CounterAA4" type="xs:string" minOccurs="0" /><xs:element name="Flagged" type="xs:boolean" /><xs:element name="DocumentsOnly" type="xs:boolean" /><xs:element name="AllowInitialDraw" type="xs:boolean" /><xs:element name="AllowManualUnderwriting" type="xs:boolean" /><xs:element name="Manufacturer_id" type="xs:int" /><xs:element name="ManufacturerType" type="xs:int" /><xs:element name="ANIPhoneNumber" type="xs:string" minOccurs="0" /><xs:element name="TransactionFee" type="xs:boolean" minOccurs="0" /><xs:element name="ConfirmationNumber" type="xs:string" minOccurs="0" /><xs:element name="PrimaryApplicant" type="xs:string" minOccurs="0" /><xs:element name="InitialDrawCannotExceedCreditLimit" type="xs:boolean" /><xs:element name="InternetSourceKey" type="xs:string" minOccurs="0" /><xs:element name="TermsAccepted" type="xs:boolean" minOccurs="0" /><xs:element name="VerificationQuestion" type="xs:string" minOccurs="0" /><xs:element name="VerificationAnswer" type="xs:string" minOccurs="0" /><xs:element name="PriorDuplicateApplication_id" type="xs:int" minOccurs="0" /><xs:element name="CreativeIndicator" type="xs:string" minOccurs="0" /><xs:element name="Expired" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" /><xs:element name="ExpirationDate" msdata:ReadOnly="true" type="xs:dateTime" minOccurs="0" /><xs:element name="CreativeIndicatorText" msdata:ReadOnly="true" type="xs:string" minOccurs="0" /><xs:element name="EntryTypeType" type="xs:int" /><xs:element name="TransactionFeeWaived" type="xs:boolean" minOccurs="0" /><xs:element name="ShowWaiveFeeLink" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" /><xs:element name="AllowPriceManually" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" /><xs:element name="AllowViewPricing" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" /><xs:element name="AllowCreditLineOverride" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" /><xs:element name="AllowCloseFlags" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" /><xs:element name="AllowValidation" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" /><xs:element name="AllowDocumentsOnDemand" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" /><xs:element name="AllowCreditTerms" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" /><xs:element name="AllowInventory" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" /><xs:element name="AllowSendToMU" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" /><xs:element name="AllowEditFundingRate" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" /><xs:element name="AllowIncompleteLetter" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" /><xs:element name="AllowChangeStatus" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" /><xs:element name="AllowEdit" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" /><xs:element name="AllowProcessing" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" /><xs:element name="AllowRedecision" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" /><xs:element name="AllowPrintDocument" msdata:ReadOnly="true" type="xs:boolean" minOccurs="0" /><xs:element name="CanViewDealer" type="xs:boolean" /><xs:element name="CanViewDecisionLetter" type="xs:boolean" /><xs:element name="CanViewIncompleteLetter" type="xs:boolean" /><xs:element name="CanViewExpiredLetter" type="xs:boolean" /><xs:element name="CanViewOptInOut" type="xs:boolean" /><xs:element name="DealerEmail" type="xs:string" minOccurs="0" /><xs:element name="DealerFax" type="xs:string" minOccurs="0" /><xs:element name="SalesPerson" type="xs:string" minOccurs="0" /><xs:element name="ContractNumber" type="xs:string" minOccurs="0" /><xs:element name="HasCreditPulls" type="xs:boolean" minOccurs="0" /><xs:element name="RequireNoteOnStatusChange" type="xs:boolean" minOccurs="0" /></xs:sequence></xs:complexType></xs:element><xs:element name="spv_GetApplicationAlerts"><xs:complexType><xs:sequence><xs:element name="AlertText" msdata:ReadOnly="true" type="xs:string" minOccurs="0" /></xs:sequence></xs:complexType></xs:element></xs:choice></xs:complexType></xs:element></xs:schema><diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"><dsApplication xmlns="http://www.tempuri.org/dsApplication.xsd"><Application diffgr:id="Application1" msdata:rowOrder="0"><Application_id>28921</Application_id><Dealer_id>2431</Dealer_id><Model_id>1898</Model_id><ModelYear>2008</ModelYear><Quantity>1</Quantity><Status_id>5</Status_id><StatusUser_id>1</StatusUser_id><ApplicationEntryType_id>4</ApplicationEntryType_id><NoInitialDraw>false</NoInitialDraw><InProcess>false</InProcess><RequestedAmount>15000.0000</RequestedAmount><Dealer>Temp Dealer - AZ</Dealer><Model>Flooring</Model><Product>Flooring</Product><Status>Declined</Status><StatusType>4</StatusType><RequiresReview>false</RequiresReview><FinalStatus>true</FinalStatus><AllowOverride>false</AllowOverride><ApplicationComplete>true</ApplicationComplete><ApplicationProcessed>true</ApplicationProcessed><ManufacturerUniqueType>9</ManufacturerUniqueType><Product_id>93</Product_id><EntryType>Internet</EntryType><Flagged>false</Flagged><DocumentsOnly>false</DocumentsOnly><AllowInitialDraw>false</AllowInitialDraw><AllowManualUnderwriting>false</AllowManualUnderwriting><Manufacturer_id>15</Manufacturer_id><ManufacturerType>0</ManufacturerType><TransactionFee>false</TransactionFee><PrimaryApplicant>Anthony D Thompson</PrimaryApplicant><InitialDrawCannotExceedCreditLimit>false</InitialDrawCannotExceedCreditLimit><Expired>false</Expired><ExpirationDate>4746-04-18T08:25:28.6230000-07:00</ExpirationDate><EntryTypeType>3</EntryTypeType><TransactionFeeWaived>false</TransactionFeeWaived><ShowWaiveFeeLink>false</ShowWaiveFeeLink><AllowPriceManually>false</AllowPriceManually><AllowViewPricing>false</AllowViewPricing><AllowCreditLineOverride>true</AllowCreditLineOverride><AllowCloseFlags>false</AllowCloseFlags><AllowValidation>false</AllowValidation><AllowDocumentsOnDemand>false</AllowDocumentsOnDemand><AllowCreditTerms>false</AllowCreditTerms><AllowInventory>false</AllowInventory><AllowSendToMU>false</AllowSendToMU><AllowEditFundingRate>false</AllowEditFundingRate><AllowIncompleteLetter>false</AllowIncompleteLetter><AllowChangeStatus>true</AllowChangeStatus><AllowEdit>false</AllowEdit><AllowProcessing>false</AllowProcessing><AllowRedecision>false</AllowRedecision><AllowPrintDocument>true</AllowPrintDocument><CanViewDealer>true</CanViewDealer><CanViewDecisionLetter>true</CanViewDecisionLetter><CanViewIncompleteLetter>false</CanViewIncompleteLetter><CanViewExpiredLetter>false</CanViewExpiredLetter><CanViewOptInOut>false</CanViewOptInOut><DealerFax>8124591234</DealerFax><HasCreditPulls>true</HasCreditPulls><RequireNoteOnStatusChange>false</RequireNoteOnStatusChange></Application><spv_GetApplicationAlerts diffgr:id="spv_GetApplicationAlerts1" msdata:rowOrder="0"><AlertText>Dealer inactive for funding</AlertText></spv_GetApplicationAlerts></dsApplication></diffgr:diffgram></GetApplicationResult></GetApplicationResponse></soap:Body></soap:Envelope>

Open in new window

0
Ray PaseurCommented:
Is it absolutely necessary to use SOAP?  Any chance you can simplify with a RESTful query ?  If you can get the XML without the invalid stuff, it would be easier to get it to work right.  Or you can just use ahalya's sample code from above.  I haven't tested it, but it looks intuitively correct.
0
ahalyaCommented:
Sorry, my second comment threw you off the mark. attached is a working function.
<?
 
function CopyTaggedText($src, $tag) {
 
  $open = '<'.$tag;
  $close= '</'.$tag .'>';
  $offset = stripos($src, $open) + strlen($open);   
  
  $result = $src;
  
  $result = substr($result, $offset);
  $loc = strpos($result, '>'); //start tag might have attributes, remove them !
  $result = substr($result, $loc+1); 
  $o2 = stripos($result, $close);
  $result = substr($result, 0, $o2); 
  return trim($result);
}
 
 
$xml = "<Status  >Status is this</Status><other>kjdcfhscfhsf</other><StatusType>This is the status type</StatusType>";
 
$Status=  CopyTaggedText($xml, 'Status');
$StatusType = CopyTaggedText($xml, 'StatusType');
 
echo "XML = " . htmlspecialchars($xml)."<br>Status= $Status<br>Status Type=$StatusType";
 
?>
  
 

Open in new window

0
pdheadyAuthor Commented:
I pasted ur code into test.php and ran and got a blank screen. Running from command line gave me:

PHP Fatal error:  Call to undefined function:  stripos() in test.php on line 7
Content-type: text/html
X-Powered-By: PHP/4.3.9
0
pdheadyAuthor Commented:
Looks like ur code is incompatible with php4.3.9 so I added this and ur test worked.

if(!function_exists('stripos')) {
function stripos($haystack, $needle, $offset = 0) {
  return strpos(strtolower($haystack), strtolower($needle), $offset);
}
}
0
ahalyaCommented:
I am on PHP5.  you are right that stripos was only added recently.   Glad you fixed it.

you may also want to convert to $src and $tag to lowercase in the beginning using strtolower.
0
pdheadyAuthor Commented:
Weird, your test works good but doesnt work for my xml string output. Values are blank. When I echo the response i get the long string of data indicated earlier in postID #22824338

<?php

$response = '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';

$Status=  CopyTaggedText($response, 'Status');
$StatusType = CopyTaggedText($response, 'StatusType');
 
echo "XML Output: Status = $Status<br>Status Type = $StatusType";
   
?>


XML Output: Status =
Status Type =
0
ahalyaCommented:
It  might be a character encoding problem.  Can you convert your string to single byte characters before testing.
0
pdheadyAuthor Commented:
Not sure how to do that, but I tried this.

$xml = html_entity_decode($client->response, ENT_NOQUOTES, 'UTF-8');

And i got something. Here's the output.

XML Output: Status = 514falsefalse15000.0000Temp Dealer - AZFlooringFlooringDeclined
Status Type = 4


Seems to be grabbing the values from the following:

<Status_id>5</Status_id>
<StatusUser_id>1</StatusUser_id>
<ApplicationEntryType_id>4</ApplicationEntryType_id>
<NoInitialDraw>false</NoInitialDraw>
<InProcess>false</InProcess>
<RequestedAmount>15000.0000</RequestedAmount>
<Dealer>Temp Dealer - AZ</Dealer>
<Model>Flooring</Model>
<Product>Flooring</Product>
<Status>Declined</Status>
<StatusType>4</StatusType>

I think this part is throwing it off with your parser:

<Status_id>5</Status_id>
0
pdheadyAuthor Commented:
Thanks for your help, but this seems to do exactly what I need. I suppose your test example may work for some people so I'll give you some points.


function getStringBetween($content,$start,$end)
{
        $r = explode($start, $content);
        if (isset($r[1])){
            $r = explode($end, $r[1]);
            return $r[0];
        }
        return false;
}
 
 
 $start = "<Status>";
 $end = "</Status>";
 $Status = getStringBetween($xml,$start,$end);
 
 echo "Status = $Status<br>";
 
 $start = "<StatusType>";
 $end = "</StatusType>";
 $StatusType = getStringBetween($xml,$start,$end);
 
 echo "Status Type = $StatusType";

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.