femaledub

Custom Coded Instagram API [PHP]

Mar 18th, 2017 (edited)
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.91 KB | None | 0 0
  1. <title>Instagram API</title>
  2.  
  3. <pre>
  4.  
  5. +------------------------------------+
  6. + Open Source. +
  7. +------------------------------------+
  8. + Public Access Token: <b>s37gViTXrc</b> +
  9. +------------------------------------+
  10. + Guide +
  11. +------------------------------------+
  12. + <b>Bold</b> = Input a picture by the user +
  13. + <i>Italic</i> = Input username only +
  14. +------------------------------------+
  15. + Functions: +
  16. + &bull; <b>userid</b> +
  17. + &bull; <b>username</b> +
  18. + &bull; <b>media_id</b> +
  19. + &bull; <b>thumbnail</b> +
  20. + &bull; <b>java</b> +
  21. +------------------------------------+
  22. + &bull; <i>username</i> +
  23. + &bull; <i>bio</i> +
  24. + &bull; <i>profile_picture</i> +
  25. +------------------------------------+
  26. + ?<b>access_token</b>&<b>function</b>=&<b>input</b>= +
  27. +------------------------------------+
  28. </pre>
  29.  
  30. <?php
  31. //Don't Touch
  32. error_reporting(0);
  33. $access_token = $_GET['access_token']; //API Key
  34. $function = $_GET['function']; //Function(s)
  35. $input = $_GET['input']; //Input
  36.  
  37. //Checks to see if access token is blank
  38. if ($access_token == null) {
  39. echo '<b>You must enter your access token</b>';
  40. die();
  41. }
  42.  
  43. //Checks to see if access token matches
  44. if ($access_token == "s37gViTXrc") {
  45. if($function == null)
  46. {
  47. echo '<b>You must enter a function</b>';
  48. die();
  49. }
  50. if ($function == "userid") {
  51. $content = file_get_contents($input);
  52. if ($input == null) {
  53. echo '<b>No input</b>';
  54. } else {
  55. $first_step = explode('<meta property="instapp:owner_user_id" content="', $content);
  56. $second_step = explode('"', $first_step[1]);
  57. echo $second_step[0];
  58. }
  59. }
  60.  
  61. //Username
  62. if ($function == "username") {
  63. $content = file_get_contents($input);
  64. if ($input == null) {
  65. echo '<b>No input</b>';
  66. } else {
  67. $first_step = explode('<meta content="See this Instagram photo by ', $content);
  68. $second_step = explode(' •', $first_step[1]);
  69. echo $second_step[0];
  70. }
  71. }
  72.  
  73. //Media ID
  74. if ($function == "media_id") {
  75. $content = file_get_contents($input);
  76. if ($input == null) {
  77. echo '<b>No input</b>';
  78. } else {
  79. $first_step = explode('<meta property="al:ios:url" content="instagram://media?id=', $content);
  80. $second_step = explode('"', $first_step[1]);
  81. echo $second_step[0];
  82.  
  83. echo '_';
  84.  
  85. $first_step = explode('<meta property="instapp:owner_user_id" content="', $content);
  86. $second_step = explode('"', $first_step[1]);
  87. echo $second_step[0];
  88. }
  89. }
  90.  
  91. //Thumbnail
  92. if ($function == "thumbnail") {
  93. $content = file_get_contents($input);
  94. if ($input == null) {
  95. echo '<b>No input</b>';
  96. } else {
  97. $first_step = explode('<meta property="og:image" content="', $content);
  98. $second_step = explode('"', $first_step[1]);
  99. echo $second_step[0];
  100. }
  101. }
  102.  
  103. //Java
  104. if ($function == "java") {
  105. $content = file_get_contents($input);
  106. if ($input == null) {
  107. echo '<b>No input</b>';
  108. } else {
  109. $first_step = explode('<script type="text/javascript">window._sharedData =', $content);
  110. $second_step = explode('<', $first_step[1]);
  111. echo $second_step[0];
  112. }
  113. }
  114.  
  115. //Name
  116. if ($function == "name") {
  117. $content = file_get_contents($input);
  118. if ($input == null) {
  119. echo '<b>No input</b>';
  120. } else {
  121. $first_step = explode('<meta property="og:title" content="', $content);
  122. $second_step = explode('(', $first_step[1]);
  123. echo $second_step[0];
  124. }
  125. }
  126.  
  127. //Bio
  128. if ($function == "bio") {
  129. $content = file_get_contents($input);
  130. if ($input == null) {
  131. echo '<b>No input</b>';
  132. } else {
  133. $first_step = explode('<meta property="og:description" content="', $content);
  134. $second_step = explode('"', $first_step[1]);
  135. echo $second_step[0];
  136. }
  137. }
  138.  
  139. //Profile Pic
  140. if ($function == "profile_pic") {
  141. $content = file_get_contents($input);
  142. if ($input == null) {
  143. echo '<b>No input</b>';
  144. } else {
  145. $first_step = explode('<meta property="og:image" content="', $content);
  146. $second_step = explode('"', $first_step[1]);
  147. echo $second_step[0];
  148. }
  149. }
  150.  
  151.  
  152.  
  153. } else {
  154. echo '<b>Invalid Access Token</b>';
  155. }
  156.  
  157. ?>
Add Comment
Please, Sign In to add comment