Jump to content

Help Parsing Data


kpetsche20

Recommended Posts

I'm trying to parse this data into PHP then insert it into a mysql database.    I just need an example of how I would parse the data from this XML doc to PHP.

 

 

<?xml version="1.0" encoding="utf-8" ?>

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.cactusmedia.com/CMWS1/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
targetNamespace="http://www.cactusmedia.com/CMWS1/">

<documentation>
  CactusMedia Service to get Approved Leads
</documentation>

<types>
  <xs:schema elementFormDefault="qualified"
   targetNamespace="http://www.cactusmedia.com/CMWS1/">
   <xs:element name="AllLeadsRequest">
    <xs:complexType>
     <xs:sequence>
      <xs:element name="pubID" type="xs:unsignedInt" />
      <xs:element name="startDate" type="xs:dateTime" />
      <xs:element name="endDate" type="xs:dateTime" />
     </xs:sequence>
    </xs:complexType>
   </xs:element>
   <xs:element name="ApprovedLeads" type="tns:ApprovedLeadsRpt" />
   <xs:complexType name="ApprovedLeadsRpt">
    <xs:sequence>
     <xs:element name="Offer" minOccurs="0" maxOccurs="unbounded" type="tns:OfferEntryType" />
    </xs:sequence>
   </xs:complexType>
   <xs:complexType name="OfferEntryType">
    <xs:sequence>
     <xs:element name="Lead" minOccurs="1" maxOccurs="unbounded">
      <xs:complexType>
       <xs:sequence>
        <xs:element name="attachedID" type="tns:attachedIDType" />
        <xs:element name="price" type="tns:ofrprice" />
        <xs:element name="subAcnt" type="xs:unsignedShort" />
       </xs:sequence>
      </xs:complexType>
     </xs:element>
    </xs:sequence>
    <xs:attribute name="offerid" type="xs:unsignedInt" use="required" />
    <xs:attribute name="title" type="xs:string" use="required" />
   </xs:complexType>
   <xs:simpleType name="ofrprice">
    <xs:restriction base="xs:float">
     <xs:minInclusive value="0.01" />
     <xs:maxInclusive value="500.00" />
    </xs:restriction>
   </xs:simpleType>
   <xs:simpleType name="attachedIDType">
    <xs:restriction base="xs:string">
     <xs:minLength value="1" />
     <xs:maxLength value="64" />
    </xs:restriction>
   </xs:simpleType>
  </xs:schema>
</types>

<message name="getAllLeadsRequest">
  <part name="parameters" element="tns:AllLeadsRequest" />
</message>
<message name="getAllLeadsResponse">
  <part name="parameters" element="tns:ApprovedLeads" />
</message>

<portType name="getLeadsPortType">
  <operation name="getAllLeads">
   <input message="tns:getAllLeadsRequest" />
   <output message="tns:getAllLeadsResponse" />
  </operation>
</portType>

<binding name="getLeadsBinding" type="tns:getLeadsPortType">
  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
   <operation name="getAllLeads">
    <soap:operation soapAction="http://www.cactusmedia.com/wbsvc/WSCM1.asp"/>
    <input>
     <soap:body use="literal"/>
    </input>
    <output>
     <soap:body use="literal"/>
    </output>
   </operation>   
</binding>

<service name="CactusMediaService">
  <port name="getLeads" binding="tns:getLeadsBinding" />
</service>
</definitions>

Link to comment
https://forums.phpfreaks.com/topic/101908-help-parsing-data/
Share on other sites

Thats not really xml thats SOAP well it is xml but this one uses a SOAP syntax if it were a simpler xml you could use a xml parser

 

I think you will need a soap extension installed on your server and then you can get the data

 

and then simply make a SoapClient object

 

http://devzone.zend.com/article/689-PHP-SOAP-Extension

Link to comment
https://forums.phpfreaks.com/topic/101908-help-parsing-data/#findComment-521557
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.