bear Posted October 7, 2013 Share Posted October 7, 2013 Namecheap's API allows for grabbing info that can be displayed in WHMCs. I find it useful to have a list of expiring domains from there right on the admin homepage, so need to make a widget. Previously, I could do a foreach against the data returned from the call, and echo it all on the page. Worked fine. With upgrading to 5.2.8, I find I need to make a widget for this. I can get it to run and return data, but it will only display one domain (currently 8 are on that list) of the entire list. I know the data is accurate, because I can print_r on the command and see them all, but not within the widget block. This works when not in a widget (truncated for this post, obviously): foreach ($xml->CommandResponse->DomainGetListResult->Domain as $result) { echo "<strong><span id='smalltext'>".$result['Name'].": ".$result['Expires']."</span></strong><br />"; It would display this: domain.com: 10/10/2013 domain2.com: 10/12/2013 Does anyone know how to get a similar result passed to the $content var in a widget? My meager PHP skills aren't cutting it. 0 Quote Link to comment Share on other sites More sharing options...
bear Posted October 7, 2013 Author Share Posted October 7, 2013 Figured it out. Instantiate $content earlier in the script with $content =''; then have the lines like so: foreach ($xml->CommandResponse->DomainGetListResult->Domain as $result) { $name = $result['Name']; $expires = $result['Expires']; $content .= "<strong><span id='smalltext'>".$name.": ".$expires."</span></strong><br />"; } With that in the foreach, it shows them all. This could probably be cleaned up quite a bit, but as long as it's working, moving on. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.