Guest User

Untitled

a guest
Jul 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.18 KB | None | 0 0
  1. <?php
  2. $ch = curl_init('fundrazr.com/api/campaigns/3HjO2/activities?cb=1333406687429');
  3. curl_setopt($ch, CURLOPT_PORT, 80);
  4. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0');
  5. curl_setopt($ch, CURLOPT_TIMEOUT, 10);
  6. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  7. $curl = curl_exec($ch);
  8. curl_close($ch);
  9. $xml = simplexml_load_string($curl);
  10. foreach ($xml->entries->children() as $baby) {
  11.     $amount = 'no';
  12.     $msg = '';
  13.     $name = '';
  14.     foreach ($baby as $child) {
  15.       if ($child->getName() == 'isAnonymous' && $child == 'true') { $name = 'Anonymous'; }
  16.       if ($child->getName() == 'amount') { $amount = $child; }
  17.       if ($child->getName() == 'activityId') { $idd = $child; }
  18.       if ($child->getName() == 'message') {
  19.           $msg = $child;
  20.           $msg = str_replace("\n", "", $msg);
  21.           $msg = str_replace("\r", "", $msg);
  22.           $msg = trim($msg);
  23.       }
  24.       if ($child->getName() == 'showAmount' && $child == 'false') { $amount = 'Unknown Amount'; }
  25.       if ($child->getName() == 'owner') {
  26.         foreach ($child as $teen) {
  27.            if ($teen->getName() == 'name') { $name = $teen; }
  28.         }
  29.       }
  30.     }
  31.     if ($amount != 'no') {  echo $idd . '~ New Donation: ' . $amount . ' by ' . $name . ' ~ ' . $msg . "\n"; }
  32. }
  33. ?>
Add Comment
Please, Sign In to add comment