Code: Select all
printf("%s", $tstr->candidate[$p]->candidate_name);
Here is how I load up the object.
Code: Select all
$response = http_get("http://api.followthemoney.org/candidates.list.php/?key=myapideveloperkey","www.somewebsite.com");
$tstr = simplexml_load_string($response['FILE']);
Code: Select all
SimpleXMLElement Object
(
[@attributes] => Array
(
[state] =>
[year] =>
[office] =>
[district] =>
[party] =>
[candidate_status] =>
[candidate_name] =>
[sort] =>
[page] => 0
[next_page] => yes
[record_count] => 200
[origin] => Institute on Money in State Politics
[process_timestamp] => 06-17-2009 11:30:13
[update_timestamp] => 06-14-2009 02:37:35
)
[candidate] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[imsp_candidate_id] => 1
[state_postal_code] => VA
[state_name] => Virginia
[year] => 1999
[candidate_name] => ABBITT JR, WATKINS M
[candidate_status] => Won
[party] => DEMOCRAT
[office] => HOUSE
[district] => 059
[total_in_state_dollars] => 0
[total_out_of_state_dollars] => 0
[total_unknown_state_dollars] => 0
[party_committee_dollars] => 0
[candidate_leadership_committee_dollars] => 0
[candidate_money_dollars] => 0
[individual_dollars] => 0
[unitemized_donation_dollars] => 0
[public_fund_dollars] => 0
[non_contribution_income_dollars] => 0
[institution_dollars] => 0
[total_contribution_records] => 0
[total_dollars] => 0
)
)
[1] => SimpleXMLElement Object