Http request - sample

hi…I have checked all topics on this widget, but samples seem to be outdated, since either events or actions related to http request are not recognized by editor.
I am trying to make app which will comuicate with server via simple http protocol. I send http address with some varibles and server replies in http text. How can I do this using this widget?
thanks a lot
Andre

and maybe also a subquestion…If I get string with more variables, is there a simple way to separate string? to get part of a string? Arduino substring function?
tnx
Andre

Here is the example how to send and receive json data to and from the server:

<?php

$json = json_decode(file_get_contents('php://input'), true);
if (json_last_error() === JSON_ERROR_NONE) {
	$result = "";
	foreach($json as $key => $value) {
		$result .= $value;
	}
	print "{\"concatenated\":\"$result\", \"time\":\"".date('h:i:s', time())."\"}";
}
else {
	print "Error parsing JSON";
}

?>

image

Thanks a lot. Is it possible to adapt code to receive csv data?
best regards
Andre


Back to Flipabit >
Copyright © 2018. Flipabit Team. All rights reserved.