Hi!
I am using webservice.php, explained here, to make CRUDs in MySQL via http sucessfully. But I would like to know if there is a way to send database name, user name and password.
In the examples I found, these information are already in the webservice.php but I would like to send them as a parameter of the url.
Is it possible?
This is how I am using:
Thanks in advance.
I am using webservice.php, explained here, to make CRUDs in MySQL via http sucessfully. But I would like to know if there is a way to send database name, user name and password.
In the examples I found, these information are already in the webservice.php but I would like to send them as a parameter of the url.
Is it possible?
This is how I am using:
My BRA code:
Dim QryItn As String
QryItn = "INSERT INTO app_peditens (PEDIDO, CODITM, GTIN, DESCRI, TABELA, QUANTI, PRUNIT, PTOTAL, IMPORTID) VALUES " & CRLF & lstItn
Dim Job2 As HttpJob ' For examples, see: https://www.b4x.com/android/forum/threads/b4x-okhttputils2-with-wait-for.79345/
Job2.Initialize("Job2", Me)
Job2.PostBytes("http://www." & cUrl.Trim & "/webervice.php", QryItn.GetBytes("UTF8"))
Wait For (Job2) JobDone(Job2 As HttpJob)
Job2.Release
My php page:
<?php
$databasehost = "localhost"; // This a want to get from url parameter
$databasename = "kazam_bd"; // This a want to get from url parameter
$databaseusername ="username"; // This a want to get from url parameter
$databasepassword = "password"; // This a want to get from url parameter
$con = mysqli_connect($databasehost, $databaseusername, $databasepassword, $databasename) or die(mysqli_error($con));
mysqli_set_charset ($con , "utf8");
$query = file_get_contents("php://input");
$sth = mysqli_query($con, $query);
if (mysqli_errno($con)) {
header("HTTP/1.1 500 Internal Server Error");
echo $query.'\n';
echo "Error: " . mysqli_error($con);
}
else
{
$rows = array();
while($r = mysqli_fetch_assoc($sth)) {
$rows[] = $r;
}
$res = json_encode($rows);
echo $res;
mysqli_free_result($sth);
}
mysqli_close($con);
?>
Thanks in advance.