SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Count of RSS

  1. #1
    SitePoint Zealot
    Join Date
    Aug 2009
    Posts
    104
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Count of RSS

    Hi

    I have written code that returns items from a rss feed if certain criteria is met.

    $rss = simplexml_load_file($searchString) or die ("Unable to load XML file!");
    $totalresults = $rss->totalresults;

    My var $totalresults is returning nothing.

    How do I get the count of the # of items returned from the rss feed?

    Thanks.

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,136
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    The first step would be to perform a var_dump on $rss so you can see what was read into $rss. Once we have that, we can't help you figure out how to get the Total Results.

    Example of var_dump
    PHP Code:
    var_dump($rss); 

  3. #3
    SitePoint Zealot
    Join Date
    Aug 2009
    Posts
    104
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is the results:

    object(SimpleXMLElement)#2 (2) { ["@attributes"]=> array(1) { ["version"]=> string(3) "2.0" } ["channel"]=> object(SimpleXMLElement)#3 (8) { ["title"]=> string(5) "Juju " ["link"]=> string(229) " http://api.juju.com/jobs?partnerid=3...7.51.13&jpp=10 " ["description"]=> string(88) " Juju - Search thousands of job sites at once for local jobs in your field. " ["language"]=> string(5) "en-us" ["totalresults"]=> string(3) "661" ["startindex"]=> string(1) "0" ["itemsperpage"]=> string(2) "10" ["item"]=> array(10) { [0]=> object(SimpleXMLElement)#4 (13) { ["title"]=> string(24) "Cost Accountant " ["zip"]=> object(SimpleXMLElement)#14 (0) { } ["city"]=> string(9) "Salisbury" ["county"]=> string(8) "Wicomico" ["state"]=> string(2) "MD" ["country"]=> string(2) "US" ["source"]=> string(17) "CareerBuilder.com" ["company"]=> string(6) "Perdue" ["link"]=> string(273) " http://www.job-search-engine.com/job...from=publisher " ["onclick"]=> string(27) "juju_partner(this, '8656');" ["guid"]=> string(14) "000000006ypso7" ["postdate"]=> string(8) "07/24/12" ["description"]=> string(177) "Cost Accountant Summary of Cost Accountant This position is responsible for the cost accounting for the Perdue Fleet Garages, the HR overhead cost centers, and" } [1]=> object(SimpleXMLElement)#5 (13) { ["title"]=> string(90) "Tax Accountant- Senior Accountant -Staff Accountant /Tax Analyst" ["zip"]=> string(5) "20817" ["city"]=> string(8) "Bethesda" ["county"]=> string(10) "Montgomery" ["state"]=> string(2) "MD" ["country"]=> string(2) "US" ["source"]=> string(17) "CareerBuilder.com" ["company"]=> string(21) "Grossberg Company LLP" ["link"]=> string(318) " http://www.job-search-engine.com/job...from=publisher " ["onclick"]=> string(27) "juju_partner(this, '8656');" ["guid"]=> string(14) "000000006xzm98" ["postdate"]=> string(8) "07/21/12" ["description"]=> string(171) "Grossberg Company LLP, a mid-sized Washington DC area CPA firm, is seeking a skilled Tax Accountant to join our team in Bethesda, Maryland. In your role as a Tax " } [2]=> object(SimpleXMLElement)#6 (13) { ["title"]=> string(33) "Revenue Staff Accountant " ["zip"]=> string(5) "20878" ["city"]=> string(12) "Gaithersburg" ["county"]=> string(10) "Montgomery" ["state"]=> string(2) "MD" ["country"]=> string(2) "US" ["source"]=> string(17) "CareerBuilder.com" ["company"]=> string(14) "BroadSoft Inc." ["link"]=> string(285) " http://www.job-search-engine.com/job...from=publisher " ["onclick"]=> string(27) "juju_partner(this, '8656');" ["guid"]=> string(14) "000000006yq352" ["postdate"]=> string(8) "07/21/12" ["description"]=> string(171) "JOB SUMMARY : The Staff Accountant will be responsible for the companys financial and accounting functions including: Accounts receivable and revenue recognition." } [3]=> object(SimpleXMLElement)#7 (13) { ["title"]=> string(26) "Senior Accountant " ["zip"]=> object(SimpleXMLElement)#15 (0) { } ["city"]=> string(13) "Silver Spring" ["county"]=> string(10) "Montgomery" ["state"]=> string(2) "MD" ["country"]=> string(2) "US" ["source"]=> string(17) "CareerBuilder.com" ["company"]=> string(7) "Unknown" ["link"]=> string(279) " http://www.job-search-engine.com/job...from=publisher " ["onclick"]=> string(27) "juju_partner(this, '8656');" ["guid"]=> string(14) "000000006uofii" ["postdate"]=> string(8) "07/06/12" ["description"]=> string(178) "…thanksgiving and Christmas gift cards, bonuses, etc. They're looking for a strong Senior Accountant who takes initiative and is looking to take the next step in their" } [4]=> object(SimpleXMLElement)#8 (13) { ["title"]=> string(39) "Senior Property Accountant (AW)" ["zip"]=> object(SimpleXMLElement)#16 (0) { } ["city"]=> string(11) "Chevy Chase" ["county"]=> string(10) "Montgomery" ["state"]=> string(2) "MD" ["country"]=> string(2) "US" ["source"]=> string(25) "Robert Half International" ["company"]=> string(32) "Robert Half Finance & Accounting" ["link"]=> string(289) " http://www.job-search-engine.com/job...from=publisher " ["onclick"]=> string(27) "juju_partner(this, '8656');" ["guid"]=> string(14) "0000000070t9yz" ["postdate"]=> string(8) "08/03/12" ["description"]=> string(178) "Senior Property Accountant (AW) My client is one of DC's largest Real Estate Commercial Developers. They are experiencing a great deal of growth which has caused the need" } [5]=> object(SimpleXMLElement)#9 (13) { ["title"]=> string(39) "Senior Property Accountant (AW)" ["zip"]=> string(5) "20815" ["city"]=> string(11) "Chevy Chase" ["county"]=> string(10) "Montgomery" ["state"]=> string(2) "MD" ["country"]=> string(2) "US" ["source"]=> string(17) "CareerBuilder.com" ["company"]=> string(35) "Robert Half Finance & Accounting US" ["link"]=> string(289) " http://www.job-search-engine.com/job...from=publisher " ["onclick"]=> string(27) "juju_partner(this, '8656');" ["guid"]=> string(14) "0000000070ofpe" ["postdate"]=> string(8) "08/02/12" ["description"]=> string(169) "Classification: Property Accountant Compensation: $67,500.99 to $82,500.99 per year My client is one of DC's largest Real Estate Commercial Developers. They are" } [6]=> object(SimpleXMLElement)#10 (13) { ["title"]=> string(31) "Staff Accountant (CRB)" ["zip"]=> object(SimpleXMLElement)#17 (0) { } ["city"]=> string(9) "Rockville" ["county"]=> string(10) "Montgomery" ["state"]=> string(2) "MD" ["country"]=> string(2) "US" ["source"]=> string(25) "Robert Half International" ["company"]=> string(32) "Robert Half Finance & Accounting" ["link"]=> string(278) " http://www.job-search-engine.com/job...from=publisher " ["onclick"]=> string(27) "juju_partner(this, '8656');" ["guid"]=> string(14) "0000000070dram" ["postdate"]=> string(8) "08/01/12" ["description"]=> string(186) "Staff Accountant (CRB) Our client, a growing construction/design company located in Montgomery County, is looking for a Staff Accountant . This Staff Accountant " } [7]=> object(SimpleXMLElement)#11 (13) { ["title"]=> string(34) "Revenue Accountant - Staff" ["zip"]=> object(SimpleXMLElement)#18 (0) { } ["city"]=> string(12) "Gaithersburg" ["county"]=> string(10) "Montgomery" ["state"]=> string(2) "MD" ["country"]=> string(2) "US" ["source"]=> string(6) "Kforce" ["company"]=> string(6) "Kforce" ["link"]=> string(285) " http://www.job-search-engine.com/job...from=publisher " ["onclick"]=> string(27) "juju_partner(this, '8656');" ["guid"]=> string(14) "000000006ydsru" ["postdate"]=> string(8) "07/23/12" ["description"]=> string(169) "The Revenue Accountant will be responsible for the company's financial and accounting functions including: accounts receivable, inventory, invoicing and revenue" } [8]=> object(SimpleXMLElement)#12 (13) { ["title"]=> string(71) "Single Family Accountant Assistant - Administrative Officer II" ["zip"]=> string(5) "21032" ["city"]=> string(11) "Crownsville" ["county"]=> string(12) "Anne Arundel" ["state"]=> string(2) "MD" ["country"]=> string(2) "US" ["source"]=> string(15) "iHireJobNetwork" ["company"]=> string(35) "Department of Budget and Management" ["link"]=> string(320) " http://www.job-search-engine.com/job...from=publisher " ["onclick"]=> string(27) "juju_partner(this, '8656');" ["guid"]=> string(14) "000000006r5qug" ["postdate"]=> string(8) "06/18/12" ["description"]=> string(178) "Community Development Administration Single Family Accountant Assistant (C11046)(Administrative Officer II) This is a Contractual Position with no fringe benefits Hiring" } [9]=> object(SimpleXMLElement)#13 (13) { ["title"]=> string(25) "Staff Accountant " ["zip"]=> string(5) "20814" ["city"]=> string(8) "Bethesda" ["county"]=> string(10) "Montgomery" ["state"]=> string(2) "MD" ["country"]=> string(2) "US" ["source"]=> string(25) "Robert Half International" ["company"]=> string(11) "Accountemps" ["link"]=> string(273) " http://www.job-search-engine.com/job...from=publisher " ["onclick"]=> string(27) "juju_partner(this, '8656');" ["guid"]=> string(14) "0000000071kzc6" ["postdate"]=> string(8) "08/01/12" ["description"]=> string(185) "Staff Accountant Staff Accountant , Long-Term Assignment with Full-Time Potential! Temporary Staff Accountant needed for mid sized Company located in Bethesda." } } } }

  4. #4
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,136
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Okay, from a quick glance, it looks like totalresults is part of channel. So I believe you can access it by $rss->channel->totalresults


Tags for this Thread

Bookmarks

Posting Permissions

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