trying to get xml variables w/php

Discussion in 'XML & RSS' started by powell1, Nov 17, 2007.

  1. #1
    hey what's up. Here is the xml I'm working with:


    <response>
        <query>help</query>
        <location></location>
        <dupefilter>true</dupefilter>
        <highlight>false</highlight>
    
        <totalresults>277309</totalresults>
        <start>1</start>
        <end>10</end>
        <results>
    
            <result>
                <jobtitle>Help Desk</jobtitle>
    
                <company>Harris Corporation</company>
                <city>Herndon</city>
                <state>VA</state>
                <country>US</country>
                <source>Harris Corporation</source>
                <date>Sat, 17 Nov 2007 07:48:17 GMT</date>
    
                <snippet>Help Desk Job ID: HTSC11071022 Service Desk... environment, preferably in an IT call center/help desk environment. * Ability to adjust to varying...</snippet>
                <url>http://www.indeed.com/viewjob?jk=3daf970e51f75243&amp;indpubnum=4273936228542969</url>
                <onmousedown>indeed_clk(this,'4896');</onmousedown>
    
                <jobkey>3daf970e51f75243</jobkey>
            </result>
       </results>
    </response>
    Code (markup):
    At the top, under <response> are the variables I need. I can get the info out of the <results> heading using a foreach loop:

    foreach ($avail->results-> result as $result)

    But I can't seem to figure out why I can't get the variables out of the top. I've tried:

    $searchresults = $avail->response->totalresults;

    and

    $searchresults = $avail->totalresults;

    I'm not sure why I can't get these. Any ideas? Thanks!
     
    powell1, Nov 17, 2007 IP
  2. powell1

    powell1 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    oh and if it helps, $avail = simplexml_load_file(longassurl);

    thx
     
    powell1, Nov 17, 2007 IP