POST A QUERY over http

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
gepponline
Posts: 91
Joined: Tue Sep 03, 2013 1:53 pm

POST A QUERY over http

Post by gepponline » Thu Mar 26, 2015 11:00 am

Hi!
I'm trying to communicate with an oracle DB using a web layer.

So, on my server i have this PHP file:

Code: Select all

<?

function eseguiSQL ($conn, $querySQL)
{  
	$stmt0 = oci_parse($conn, $querySQL);
	oci_execute($stmt0);
	return($stmt0);
}


// get string from caller
$stringa=$_GET['stringa'];
$array = explode("|", $stringa);
$querySQL=$array[0];
$operazione=$array[1];
etc etc...
?>
I post using the POST function a Query with a pipe and a letter that identify the type of query.

Code: Select all

POST tPost to URL "http://portal.tenax.spa/app_sql_oracle.php"
tPost contain this string: UPDATE TF_MASCHI SET UBICAZIONE='TX2' WHERE NUMERO='999999' AND TIPO='D 25'|U

Obviously nothing work.... :cry:

I think it's the GET function in the php file that don't match with my post function....
Can anyone help me?

ghettocottage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 366
Joined: Tue Apr 10, 2012 9:18 am

Re: POST A QUERY over http

Post by ghettocottage » Thu Mar 26, 2015 2:14 pm

I could be wrong, but I think you would use $_POST[] rather than $_GET[] on your php page.

$_GET[] is for when you pass stuff via the url like:

http://portal.tenax.spa/app_sql_oracle. ... gsomething

gepponline
Posts: 91
Joined: Tue Sep 03, 2013 1:53 pm

Re: POST A QUERY over http

Post by gepponline » Thu Mar 26, 2015 2:17 pm

You're right!

I've just solved replacing GET with POST and posting the "VARIABLENAME="&tPost as data of my function :)

thank you.

Do you know if there is a way to get something back from the php page?

ghettocottage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 366
Joined: Tue Apr 10, 2012 9:18 am

Re: POST A QUERY over http

Post by ghettocottage » Thu Mar 26, 2015 2:38 pm

I have been using LC Server for that sort of thing, but I think PHP is the same principal.

On my server I would do:

Put "this is the info I want to get"


and on my app i would do:

put url "yourDBhost/simpleretrieve.lc" into tData

and now tData would have "this is the info I want to get"



On php you might just: echo "this is the info I want to get"

and then on LC app you might:

put url "http://portal.tenax.spa/app_sql_oracle.php" into tData

But I have not tried with PHP yet, so just guessing

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”