<commit_before><?php
// Content type header can fix character formatting issues BUT!!! this MUST be the first line if you use it !
header('Content-Type: text/html; charset=utf-8'); 
ini_set('display_errors', 1);

// pull in the Twitter API helper file
require_once('TwitterAPIExchange.php');

/** Set access tokens here - see: https://dev.twitter.com/apps/ **/
$settings = array(
    'oauth_access_token' => "YOUR ACCESS TOKEN",
    'oauth_access_token_secret' => "YOUR ACCESS TOKEN SECRET",
    'consumer_key' => "YOUR API KEY",
    'consumer_secret' => "YOUR API SECRET"
);

// The Twitter API endpoint URL. 
// See https://dev.twitter.com/docs/api/1.1/get/search/tweets
$url = 'https://api.twitter.com/1.1/search/tweets.json'; 

// for search terms with spaces, apostrophes, etc, you must url encode. See: http://us3.php.net/manual/en/function.urlencode.php
$searchterm = urlencode('polar vortex');
//$getfield = '?q=cats'; 
$getfield = '?q='.$searchterm;
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);

$json_text = $twitter->setGetfield($getfield)
             ->buildOauth($url, $requestMethod)
             ->performRequest();



// turn the json text into a PHP array -- see http://us3.php.net/manual/en/function.json-decode.php
$json_array = json_decode($json_text,true);

// debug: show the PHP array that was created:
//var_dump($json_array);

$statuses = $json_array['statuses'];
// loop through the array and get every tweet
foreach ($statuses as $tweet){
    echo '<p>';
    echo '<strong>@'.$tweet['user']['screen_name'].'</strong><br/>';
    echo $tweet['text'];
    echo '<br/> <em>'. $tweet['created_at'] . '</em>';  
    echo '</p>';
}<commit_msg>changed twitter search file to use PHP objects<commit_after><?php
// Content type header can fix character formatting issues BUT!!! this MUST be the first line if you use it !
header('Content-Type: text/html; charset=utf-8'); 
ini_set('display_errors', 1);

// pull in the Twitter API helper file
require_once('TwitterAPIExchange.php');

/** Set access tokens here - see: https://dev.twitter.com/apps/ **/
$settings = array(
    'oauth_access_token' => "YOUR ACCESS TOKEN",
    'oauth_access_token_secret' => "YOUR ACCESS TOKEN SECRET",
    'consumer_key' => "YOUR API KEY",
    'consumer_secret' => "YOUR API SECRET"
);

// The Twitter API endpoint URL. 
// See https://dev.twitter.com/docs/api/1.1/get/search/tweets
$url = 'https://api.twitter.com/1.1/search/tweets.json'; 

// for search terms with spaces, apostrophes, etc, you must url encode. See: http://us3.php.net/manual/en/function.urlencode.php
$searchterm = urlencode('polar vortex');
//$getfield = '?q=cats'; 
$getfield = '?q='.$searchterm;
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);

$json_text = $twitter->setGetfield($getfield)
             ->buildOauth($url, $requestMethod)
             ->performRequest();


// turn the json text into a PHP object -- see http://us3.php.net/manual/en/function.json-decode.php
$json_object = json_decode($json_text);

// debug: show the PHP object that was created:
//var_dump($json_object);

$statuses = $json_object->statuses;
// loop through the array and get every tweet
foreach ($statuses as $tweet){
    echo '<p>';
    echo '<strong>@'.$tweet->user->screen_name.'</strong><br/>';
    echo $tweet->text;
    echo '<br/> <em>'. $tweet->created_at . '</em>';  
    echo '</p>';
}
{'fraction_non_alphanumeric': 0.17205882352941176, 'fraction_numerical': 0.004705882352941176, 'mean_word_length': 3.900576368876081, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 38, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5694312', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1116, 'n_words': 297}