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.

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

var_dump($rss);

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=37414015f91d680aa8a355ca8438c776&k=accountant&l=maryland&useragent=Mozilla%2F5.0+(compatible&+MSIE+9.0=&+Windows+NT+6.1=&+WOW64=&+Trident%2F5.0)=&ipaddress=174.117.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/Cost-Accountant-Salisbury-MD-000000006ypso7?impression_id=PIZn6lICRBKqovkbnACU_Q&partnerid=37414015f91d680aa8a355ca8438c776&channel=&k=accountant&l=maryland&track_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/Tax-Accountant-Senior-Accountant-Staff-Accountant-Tax-Analyst-Bethesda-MD-000000006xzm98?impression_id=VyQSgoJuQKafIemewVcxJg&partnerid=37414015f91d680aa8a355ca8438c776&channel=&k=accountant&l=maryland&track_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/Revenue-Staff-Accountant-Gaithersburg-MD-000000006yq352?impression_id=SKxKrUhxS62OnbwjpS0IOg&partnerid=37414015f91d680aa8a355ca8438c776&channel=&k=accountant&l=maryland&track_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/Senior-Accountant-Silver-Spring-MD-000000006uofii?impression_id=uW3Sqxe7SMO2tiS3cbLkVA&partnerid=37414015f91d680aa8a355ca8438c776&channel=&k=accountant&l=maryland&track_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/Senior-Property-Accountant-AW-Chevy-Chase-MD-0000000070t9yz?impression_id=yPOqEBPNRZKW_tANISvdAA&partnerid=37414015f91d680aa8a355ca8438c776&channel=&k=accountant&l=maryland&track_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/Senior-Property-Accountant-AW-Chevy-Chase-MD-0000000070ofpe?impression_id=QpgSlRArR0CjLSM34JeDtA&partnerid=37414015f91d680aa8a355ca8438c776&channel=&k=accountant&l=maryland&track_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/Staff-Accountant-CRB-Rockville-MD-0000000070dram?impression_id=m3vkTAVlSDePej-IOYRGMw&partnerid=37414015f91d680aa8a355ca8438c776&channel=&k=accountant&l=maryland&track_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/Revenue-Accountant-Staff-Gaithersburg-MD-000000006ydsru?impression_id=tUwxrdE0TCeigLSvAe0VhA&partnerid=37414015f91d680aa8a355ca8438c776&channel=&k=accountant&l=maryland&track_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/Single-Family-Accountant-Assistant-Administrative-Officer-II-Crownsville-MD-000000006r5qug?impression_id=-RhBqWMzRy2uogJOUB13rw&partnerid=37414015f91d680aa8a355ca8438c776&channel=&k=accountant&l=maryland&track_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/Staff-Accountant-Bethesda-MD-0000000071kzc6?impression_id=3SO3_HwkRqepjanBXrlcDA&partnerid=37414015f91d680aa8a355ca8438c776&channel=&k=accountant&l=maryland&track_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.” } } } }

Okay, from a quick glance, it looks like totalresults is part of channel. So I believe you can access it by $rss->channel->totalresults