Are you a regular stikked user? Signup so you can keep track of your pastes!
  1. <?php
  2. function file_get_the_contents($url) {
  3.   $ch = curl_init();
  4.   $timeout = 5; // set to zero for no timeout
  5.   curl_setopt ($ch, CURLOPT_URL, $url);
  6.   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  7.   curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
  8.   $file_contents = curl_exec($ch);
  9.   curl_close($ch);
  10.   return $file_contents;
  11. }
  12.     $url = "http://api.betacie.com/view/random?key=readonly&language=en";
  13.     $data = file_get_the_contents($url);
  14.  
  15.    
  16.     $ObjDOM = new DOMDocument();
  17.     $ObjDOM->loadXML($data);
  18.     $fml = $ObjDOM->getElementsByTagName("item")->item(0)->getElementsByTagName("text")->item(0)->nodeValue;
  19.     $a = $ObjDOM->getElementsByTagName("item")->item(0)->getElementsByTagName("agree")->item(0)->nodeValue;
  20.     $b = $ObjDOM->getElementsByTagName("item")->item(0)->getElementsByTagName("deserved")->item(0)->nodeValue;
  21.     $c = $ObjDOM->getElementsByTagName("item")->item(0)->getAttribute("id");
  22.     $rating = $a - $b;
  23.     if ($rating >= 0) { $rating = '(' . chr(3) . '03+' . $rating . chr(3). ')'; }
  24.     if ($rating < 0) { $rating = '(' . chr(3) . '04' . $rating . chr(3). ')'; }
  25.  
  26.  
  27.     echo ltrim("FML #$c: $fml $rating", "\t") . "\n";
  28. ?>

Reply to "Untitled"

Here you can reply to the paste above

Create a snipurl

Make Private

Feeling clever? Set some advanced options.