How do you use php to communicate with App Inventors TinyWebDB component?

195

Google App Inventor has some information in their documentation for setting up a sample TinyWebDB webservice using python or app engine, however, I'm trying to use php. Is this possible? I've followed directions posted here but all I get is the error:

Communication with the web service encountered a protocol exception

I display this error in alabel component on the whenTinyWebDB1.WebServiceError block.

So here is what I have in my php files:

getvalue.php

header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 2010 05:00:00 GMT');
header('Content-type: application/json');

$retval = array("VALUE", "tagged", '"'.time().'"'); 
echo json_encode($retval);

Which returns:

["VALUE","tagged","\"1283093117\""]

setvalue.php

$tag = $_POST['tag'];
$value = $_POST['value'];
$retval = array("STORED", '"'.$tag.'"', '"'.$value.'"');
echo json_encode($retval);

Which returns:

["STORED","\"tagged\"","\"testdata\""]

Thanks for any suggestions or answers.

645

Answer

Solution:

Instead of "setvalue", you should use "storeavalue"

People are also looking for solutions to the problem: php - Using my database class with other classes in my project

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.