Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. $curl = curl_init( $communityUrl . '/core/members/' );
  2. curl_setopt_array( $curl, array(
  3. CURLOPT_RETURNTRANSFER => TRUE,
  4. CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
  5. CURLOPT_USERPWD => "{$apiKey}:"
  6. ) );
  7. $response = curl_exec( $curl );
  8. $data = json_decode($response, true);
  9. $count = 0;
  10. foreach($data as $member) {
  11. if (is_array($member)) {
  12. foreach($member as $name) {
  13. if($count > 4)
  14. return;
  15. echo '<p class="top-member-p"><a href="'.$name['profileUrl'].'">'.ucfirst($name['name']).'</a> has '.$name['posts'] . ' posts</p>';
  16. $count++;
  17. }
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement