10-24-2014
|
19
|
Zone iPhone Manager
Join Date: Nov 2011
Posts: 199
|
I am very good at proofs. Here's my "API"...
PHP Code:
<?php $user = $_GET['u']; if(!$user){ die(); } function contains($val1, $val2){ if(strpos($val1, $val2) !== false){ return true; } return false; } $image_url = null; $image_full = null; $nickname = null; $username = null; $url = "http://kik.com/u/" . $user; $data = file_get_contents($url); $delim = "\r\n"; $line = strtok($data, $delim); $name_next = false; $pic_next = false; $user_next = false; while($line !== false) { $line = strtok($delim); if($user_next){ $username = strip_tags(trim($line)); $user_next = false; } if($name_next){ $nickname = strip_tags(trim($line)); $name_next = false; } if($pic_next){ preg_match('/<img(.*)src(.*)=(.*)"(.*)"/U', $line, $result); $image_url = array_pop($result); $image_full = str_replace("thumb", "orig", $image_url); $pic_next = false; } if(contains($line, "<dt>NAME:</dt>")){ $name_next = true; } if(contains($line, "profile2")){ $pic_next = true; } if(contains($line, "USERNAME:")){ $user_next = true; } } $array = array($username, $nickname, $image_url, $image_full); $json = json_encode($array); echo($json); ?>
|
|
|