<?php
date_default_timezone_set("Asia/Bangkok");echo date_default_timezone_get();
<?php
date_default_timezone_set("Asia/Bangkok");//Replace the newline and carriage return characters
//using regex and preg_replace.
$text = preg_replace("/\r|\n/", "", $text);
remove \r\n
https://www.studentstutorial.com/php/php-crud
https://drive.google.com/file/d/14579xTbSKyI3ZSJHfMSRSPBwpN8oJooC/view?usp=sharing
require google/cloud-speech
https://cloud.google.com/speech-to-text/docs/quickstart-client-libraries#client-libraries-install-php
$url
) where the JSON data need to be sent.application/json
using the CURLOPT_HTTPHEADER option.// API URL
$url = 'http://www.example.com/api';
// Create a new cURL resource
$ch = curl_init($url);
// Setup request to send json via POST
$data = array(
'username' => 'codexworld',
'password' => '123456'
);
$payload = json_encode(array("user" => $data));
// Attach encoded JSON string to the POST fields
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
// Set the content type to application/json
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
// Return response instead of outputting
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute the POST request
$result = curl_exec($ch);
// Close cURL resource
curl_close($ch);
The following example shows how you can get or fetch the JSON POST data using PHP.
$data = json_decode(file_get_contents('php://input'), true);
install dependencies sudo apt-get install php7.0-pgsql
yum install php-pgsql
restart apache
https://stackoverflow.com/questions/38981799/unable-to-install-php5-pgsql-on-ubuntu-16-04/42772824
<?php
$host = "host = hus-west-2.rds.amazonaws.com";
$port = "port = 5432";
$dbname = "dbname = product";
$pass="dElm0zL";
$pid=$argv[1];
$credentials = "user=phone password=$pass";
$db = pg_connect( "$host $port $dbname $credentials" );
if(!$db) {
echo "Error : Unable to open database\n";
} else {
echo "Opened database successfully\n";
}
$sql =<<<EOF
SELECT * FROM public.howardmillerinventory where "Clock"='$pid'
EOF;
$ret = pg_query($db, $sql);
if(!$ret) {
echo pg_last_error($db);
exit;
}
while($row = pg_fetch_row($ret)) {
echo "Item# = ". $row[0] . "\n";
echo "Stock= ". $row[1] ."\n";
}
echo "Operation done successfully\n";
pg_close($db);
?>
https://makitweb.com/how-to-export-mysql-table-data-as-csv-file-in-php/
https://www.itechempires.com/2016/05/export-data-from-mysql-to-csv-using-php/
run sudo visudo
root ALL=(ALL) ALL
wwwrun ALL=NOPASSWD: /usr/sbin/iptables
<?php | |
$link = mysqli_connect("localhost", "root", "2224psss", "dialer"); | |
/* check connection */ | |
if (mysqli_connect_errno()) { | |
printf("Connect failed: %s\n", mysqli_connect_error()); | |
exit(); | |
} | |
$query = "INSERT INTO `audio` (`audio_id`, `audio_name`, `audio_desc`, `audio_path`, `audio_size`, `audio_date`) | |
VALUES (NULL, 'audio_name', 'Audio desc', 'path', '100MB', CURRENT_TIMESTAMP)"; | |
if(mysqli_query($link, $query)) { | |
printf ("New Record has id %d.\n", mysqli_insert_id($link)); | |
} | |
else { | |
printf("Error: %s\n", mysqli_error($link)); | |
} | |
/* close connection */ | |
mysqli_close($link); | |
?> |
196.179.2.65 154.104.154.150 102.158.71.137 196.179.45.12 102.156.151.182 196.179.27.230 41.227.238.97
<?php $dbhost='localhost'; $dbuser='root'; $dbpass=789456; $dbname='codigos'; $db = mysqli_connect($dbhost, $dbuser, $dbpass) or die("Couldn't connect to the database."); mysqli_select_db($db,$dbname) or die("Couldn't select the database"); //--------------- AUTHENTICATION MODULE -------------------------- function displayLogin() { header("WWW-Authenticate: Basic realm=\"Ambiorix\""); header("HTTP/1.0 401 Unauthorized"); echo "<h2>Authentication Failure</h2>"; echo "The username and password provided did not work. Please reload this page and try again."; exit; } if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) { // If username or password hasn't been set, display the login request. displayLogin(); } else { // Escape both the password and username string to prevent users from inserting bogus data. $PHP_AUTH_USER = addslashes($_SERVER['PHP_AUTH_USER']); //$PHP_AUTH_PW = md5($PHP_AUTH_PW); $PHP_AUTH_PW = $_SERVER['PHP_AUTH_PW']; // Check username and password against the database. $query="SELECT count(user_id) as valid FROM codeusers WHERE password='$PHP_AUTH_PW' AND user='$PHP_AUTH_USER' "; $result = mysqli_query($db, $query); while ($row = mysqli_fetch_assoc($result)) { if($row[valid]<1) { displayLogin(); } } } ?>
$res = preg_replace("/[^0-9]/", "", "Every 6 Months" );
$res = preg_replace("/[^0-9.]/", "", "$ 123.099");