Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php include 'php/getTweets.php' ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <!-- Required meta tags -->
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <link href="https://fonts.googleapis.com/css?family=Raleway:400,900" rel="stylesheet">
- <link rel="stylesheet" href="css/ionicons.min.css">
- <!-- Bootstrap CSS -->
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
- <link rel="stylesheet" href="css/styles.css">
- </head>
- <body>
- <div class="overlay">
- <div class="input">
- <input type="text" placeholder="search"><i class="ion-ios-search-strong"></i>
- </div>
- </div>
- <!-- jQuery first, then Bootstrap JS. -->
- <script src="https://code.jquery.com/jquery-3.2.1.min.js"
- integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
- crossorigin="anonymous"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
- <script src="js/script.js"></script>
- </body>
- </html>
- $(document).ready(function(){
- $('i').click(function() {
- // save search input
- var searchTerm = $('input').val();
- $.ajax({
- type: 'GET',
- url: "../php/index.php",
- dataType: 'JSON',
- data: {
- searchTerm: searchTerm
- },
- success: function(data) {
- console.log(data);
- }
- })
- })
- });
- <?php
- //Store search input
- $searchTerm = $_GET['searchTerm'];
- //Keys and tokens
- $consumer_key = '';
- $consumer_secret = '';
- $access_token = '';
- $access_token_secret = '';
- //Include Library
- require "twitteroauth-master/autoload.php";
- use AbrahamTwitterOAuthTwitterOAuth;
- //Connect to API
- $connection = new TwitterOAuth($consumer_key, $consumer_secret, $access_token, $access_token_secret);
- $content = $connection->get("account/verify_credentials");
- //Get Tweets
- $statuses = $connection->get("search/tweets", [q => "Cats", "count" => 1, "result_type" => "popular"]);
- print_r($statuses);
- ?>
Add Comment
Please, Sign In to add comment