Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. <?php
  2.  
  3. $data = file_get_contents('http://developer.android.com/reference/classes.html');
  4. $class = $_GET['name'];
  5. $keyword = $class . '.html';
  6. $lengthKey = strlen($keyword);
  7.  
  8. $pos = strpos($data, $keyword);
  9.  
  10. $substring = $keyword;
  11. $i = 0;
  12.  
  13. $firstTen = substr($substring, 0, 10);
  14. $match = "/reference";
  15. while($firstTen != $match) {
  16.     $i = $i + 1;
  17.     $substring = substr($data, $pos-$i, $lengthKey+$i);
  18.     $firstTen = substr($substring, 0, 10);
  19.  
  20. }
  21.  
  22. $finalURL = 'http://developer.android.com' . $substring;
  23.  
  24.  
  25. $final = '[' . $class . ']('.$finalURL.')';
  26.  
  27. if( isset( $_REQUEST['callback'] ) ) {
  28.     echo $_REQUEST['callback'] . "({src:'" . $final ."'});";
  29. } else {
  30.     echo $final;
  31. }
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement