mirror of
https://github.com/thewesker/greptweet.git
synced 2025-12-20 04:01:06 -05:00
17 lines
426 B
PHP
17 lines
426 B
PHP
<?php
|
|
header('Content-type: application/json');
|
|
if (empty($_GET['q'])) { die(); }
|
|
|
|
// Is this the correct way to sanitise args to shell from PHP?
|
|
$QUERY=escapeshellarg($_GET['q']);
|
|
|
|
// Debug Logging
|
|
//$fp = fopen('debug.log', 'a');
|
|
//fwrite($fp, $_GET['q'] . " : " . $QUERY . "\n");
|
|
//fclose($fp);
|
|
|
|
exec("zgrep -Fhi $QUERY tweets.txt", $array);
|
|
$data = json_encode($array);
|
|
echo $_GET['jsoncallback'] . '(' . $data . ');';
|
|
?>
|