I'm having difficulty in Matlab connecting to a local webserver and sending POST data to and from a simple script. (I'm new to urlread/write and webread/write and very new to PHP).
My Matlab script:
myURL = 'http://localhost:8000/webhook/matlabTest.php';
[s status] = urlread(myURL,'post',{'test','data'});
disp(status);
My PHP script:
<?php
$raw_text = json_encode($_POST);
echo "triggered " . $raw_text;
I've also tried in Matlab:
options = weboptions('RequestMethod','post');
[s status] = webread(myURL,'test','data',options);
disp(status);
I keep getting the Matlab error :
The server returned the message: "Connection refused" for URL, 'http://localhost:8000/webhook/matlabTest.php' (with HTTP response code 400)
but if I put http://localhost:8000/webhook/matlabTest.php
in my browser it works fine.
Any help would be appreciated!
400
is "bad request". something about what matlab is sending is not liked by the server.