Advertisement
aivavic

parser

Dec 6th, 2016
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.51 KB | None | 0 0
  1. $opts = array(
  2.     'http' => array(
  3.         'method' => "GET",
  4.     )
  5. );
  6. $context = stream_context_create($opts);
  7. $buffer = file_get_contents('http://www.powerball.com/powerball/winnums-text.txt', false, $context);
  8. $search   = array("\r\n", "\n", "\r");
  9. $replace = '++';
  10. $buffer = explode($replace, str_replace($search, $replace, $buffer));
  11. foreach($buffer as $key => $item){
  12.     if($key > 0){
  13.         $result[] = explode(" ", str_replace("  ", " ", $item));
  14.     }
  15. }
  16. $result = json_encode($result);
  17. echo $result;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement