I am working with an api. I have code in place to get account results which do work. Here is the code
$Envato = new Envato_marketplaces(); $Envato->set_api_key('my api key'); $account_info = $Envato->account_information('my account name'); $Envato->prettyPrint($account_info);
the above code spits out this
stdClass Object ( [image] => path to my avatar [firstname] => my first name [surname] => my last name [total_earnings] => 0.00 [total_deposits] => 0.00 [balance] => 0.00 [country] => [current_commission_rate] => 0.0 )
Now I have been able to echo out the data above by doing a foreach loop into an un ordered list. It was when I tried to call it separately that I ran into trouble. I figured out that I can do this
echo '<img src="'. $account_info->image . '" />';
what this does is create the problem of what is the best way to find the fields that can be used under account_info. Is it common practice to print_r the object in the above array format to find the fields or is there a better way?
My main question that I would like answered if you please is how do I get the object into an array so that it can be accessed like so
You should know that my coding skills are beginner at best. Please try to keep that in mind if you offer up a solution. Thank you for your time.