405 HTTP Request Error

Hi all,

I just started working with electric imp and am trying to get data (num) from my imp to a XAMPP webpage.
I followed the tutorial for HTTP Request. But instead of getting “200”, I get “405”.

My planner looks like:

My imp code is:

// Output port to send temperature readings local output = OutputPort("number");

// Register with the server
imp.configure(“Logger”, [], [output]);

local num = 12;

// End of code.

My php is:

<?php /* Electric Imp POST Example */

$fd = fopen(‘impdata.txt’, ‘a’);

if(flock($fd, LOCK_EX))
	fwrite($fd, $_POST['target'] . ' ' . $_POST['channel'] . ' ' . gmdate('Y-m-d H:i:s') . ' ' . number_format($_POST['value'], 2) . "C\

flock($fd, LOCK_UN);




Any help is greatly appreciated! Thanks!

It looks like you are trying to host your webpage locally, which your imp can’t access (at least using localhost as the address).

For the imp, http://localhost refers to the server the imp cloud is running on - which is not where your webpage is.

I see. That seems a bit inconvenient for developing…
Is there another way to have a local php script? Or do I need to host it at an external web URL? How would you recommend referencing my php page?

Thanks for the help!

use your external IP-address and set a forwarding rule on your router.
Don’t forget to open your firewall on port 80 incoming

It works perfectly now.
Thanks all! :smiley: