Advertisement
ranisalt

Untitled

Apr 6th, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. function array_filter_recursive(array $array) {
  3.     foreach($array as $key => $value) {
  4.         if (is_array($value)) {
  5.             array_filter_recursive($value)
  6.         }
  7.         if (empty($value)) {
  8.             unset($array[$key]);
  9.         }
  10.     }
  11. }
  12.  
  13. require('phpQuery/phpQuery.php');
  14. $html = file_get_contents('http://www.tibia.com/community/?subtopic=characters&name='.$_GET['name']);
  15. $query = phpQuery::newDocument($html);
  16. $guild = $teste['.BoxContent td:contains("membership:")']->next()->text();
  17. $guild = explode(' of the ', $guild);
  18. $output = array(
  19.     'guild' => array(
  20.         'rank' => $guild[0],
  21.         'name' => $guild[1]
  22.     )
  23. );
  24. header('Content-type: application/json');
  25. echo json_encode(array_filter_recursive($output), JSON_PRETTY_PRINT);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement