www.webdeveloper.com
Results 1 to 2 of 2

Thread: Help with XML parsing

  1. #1
    Join Date
    Mar 2010
    Posts
    2

    Exclamation Help with XML parsing

    Hello everyone,

    Need your help. Didn't have that much of experience with XML, but working with it on one project.

    Below is a sample of API call that returns XML:

    Code:
    <RateSummary:rateSummary xsi:schemaLocation="http://www.zillow.com/static/xsd/RateSummary.xsd http://www.zillow.com/vstatic/d288affb5161120f01499a76ced68c8b/static/xsd/RateSummary.xsd">
    −
    <request>
    </request>
    −
    <message>
    <text>Request successfully processed</text>
    <code>0</code>
    </message>
    −
    <response>
    −
    <today>
    <rate count="41" loanType="thirtyYearFixed">4.9</rate>
    <rate count="10" loanType="fifteenYearFixed">4.25</rate>
    <rate count="10" loanType="fiveOneARM">3.51</rate>
    </today>
    −
    <lastWeek>
    <rate count="28566" loanType="thirtyYearFixed">4.83</rate>
    <rate count="12218" loanType="fifteenYearFixed">4.23</rate>
    <rate count="5899" loanType="fiveOneARM">3.66</rate>
    </lastWeek>
    </response>
    </RateSummary:rateSummary>
    I need help in parsing it and using it with php, and this is what I got so far, but nothing is showing up.

    Code:
    <?php
    $request_url = "API call that returns above xml, taken out due to ID is showing up";
    
    $xml = simplexml_load_file($request_url) or die("feed not loading");
    
    $thirty = $xml->RateSummary->response->today->rate->thirtyYearFixed;
    
    echo "$thirty";
    ?>
    Please help

    Thank you in advance.

  2. #2
    Join Date
    Mar 2010
    Posts
    2
    Anybody?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles