• Stop being a LURKER - join our dealer community and get involved. Sign up and start a conversation.

Reply to thread

I don't know if this is appropriate for this forum however if it helps someone I am glad to contribute.


Below is an example of how to extract Used vehicle inventory from Reynolds to XML and individual variables.


The code snippet below requires php scripting language and cURL libraries for the POST method HTTP request.  Running this script returns complete used inventory in XML format.  You will also need to add DNS to resolve erasv01 to your ERA boxes IP.


[php]

/*

    ERA SOAP Veh Inventory View Example

    JVK

   

    9/13/07

*/


define(USER_AGENT, 'com.reyrey.ds.eai.xmppagent.DmsTxBasePost');


$post_data    =    '<?xml version="1.0" standalone="no" ?>

<!DOCTYPE TransmissionWrapper SYSTEM

"http://b2b.reyrey.com/dtds/ERA/TransmissionWrapper.dtd">

<TransmissionWrapper TransmissionID="'.time().'">

<TransmissionData><![CDATA[

<?xml version="1.0" standalone="no" ?>

<!DOCTYPE ERAVehInvRequest SYSTEM "/vobs/era/sales01/j_src/com/reyrey/sales/dtd/ERAVehInvRequest.dtd">

<ERAVehInvRequest>

    <GenTransData OrigSysID="SALESFORCE" ProcSysID="XXXXXXXXXX"

            StoreNo="01" BranchNo="01" TransCode="VI" TransOpType="Query"

            TZ="PST" ClientId="SALESFORCE">

    <TransTimeStamp Date="'.date("m/d/Y").'" Time="'.date("H:i:s").'"/>

    </GenTransData>

    <QueryFields ERAAppl="sales" NeworUsed="U" StockNo="" VIN="" VehMake=""

                 VehModel="" Carline="" VehYear="" LowPrice="0" HighPrice="999999" />

    <OtherCriteria Name="NoRecordsToSuccess" Value="YES"/>

</ERAVehInvRequest>

]]></TransmissionData>

</TransmissionWrapper>';


$header_array[] = "Content-type: text/xml";



$ch = curl_init();


      curl_setopt($ch, CURLOPT_HTTPHEADER, $header_array);

      curl_setopt($ch, CURLOPT_POST, true);

      curl_setopt($ch, CURLOPT_URL, 'http://erasv01:8100/salesbin/ServerVehInvView');

      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

      curl_setopt($ch, CURLOPT_USERAGENT, USER_AGENT);

      curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);

     



$datum =     curl_exec($ch);

            curl_close($ch);


// Extract CDATA

$cdata_pos_1    =    strpos($datum, '<![CDATA[');

$cdata_pos_2    =    strpos($datum, ']]>', $cdata_pos_1);

$cdata_subs        =    substr($datum, ($cdata_pos_1 + 9), (($cdata_pos_2 - $cdata_pos_1) - 9));


echo $cdata_subs;


$xml     =    new SimpleXMLElement($cdata_subs);


print_r($xml);

[/php]