Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function array_filter_recursive(array $array) {
- foreach($array as $key => $value) {
- if (is_array($value)) {
- array_filter_recursive($value)
- }
- if (empty($value)) {
- unset($array[$key]);
- }
- }
- }
- require('phpQuery/phpQuery.php');
- $html = file_get_contents('http://www.tibia.com/community/?subtopic=characters&name='.$_GET['name']);
- $query = phpQuery::newDocument($html);
- $guild = $teste['.BoxContent td:contains("membership:")']->next()->text();
- $guild = explode(' of the ', $guild);
- $output = array(
- 'guild' => array(
- 'rank' => $guild[0],
- 'name' => $guild[1]
- )
- );
- header('Content-type: application/json');
- echo json_encode(array_filter_recursive($output), JSON_PRETTY_PRINT);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement