Author Topic: postData.php question  (Read 4529 times)

devguy

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
postData.php question
« on: May 29, 2011, 03:29:06 PM »
Hello all,

I currently got the "activate energy posting" function to work, but its not posting any data. I'm pretty sure the postData.php file works because if i navigate there in my browser, it will fopen (create a file). Also, on the stats.htm page it says its linked, and the URI is postData.php so I'm assuming it read the act.xml file correctly. Does anyone have any ideas how to get it to write? Thanks in advance.

P.S. my server apparently doesn't allow POST by default, and I remember somewhere TEDDev mentioned, both use the POST method. I've altered the header to Allow: POST and still no luck.

dannyted

  • Jr. Member
  • **
  • Posts: 56
  • Karma: +0/-0
    • Energy Monitor Blog
Re: postData.php question
« Reply #1 on: May 30, 2011, 09:56:52 PM »
DevGuy,

I had some trouble with this also.  This php code that was posted to the forum did work out of the box.  Two questions, one did you use the following code?  And, do you have write permissions to the directory you are posting to?
Here is the original code I used for posting:
<?php
date_default_timezone_set('America/Chicago');

$outp = fopen("../teddata/xmlfile." . date("YmdHis") . ".xml", "w");
fwrite($outp, $HTTP_RAW_POST_DATA);
fclose($outp);

?>

Lastly, what type of server are you on Windows / Linux / Apache / IIS?  Is it shared hosting provider or you server?
If you would like check out the data from my Ted5k @ http://myted5k.com/danny or myblog in signature below.
My Energy Blog - http://energymonitorblog.com
     --A site dedicated to discussing power saving information.

My Personal Blog - http://dannymullen.net

MyTed5000 - http://myted5k.com/danny/
     --Live Data from my ted5000

Like me on Facebook
http://www.facebook.com/pages/EnergyMonitorB

devguy

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: postData.php question
« Reply #2 on: May 31, 2011, 08:38:45 PM »
dannyted,

that is the code i used, except I didn't adjust for the timezone, but that shouldn't affect the output. Also, I am running apache, I believe, on a shared hosting server.

also, this is my act file
with the post server switched out

<ted500ActivationResponse>
<PostServer>demo.theenergydetective.com</PostServer>
<PostURL>/postData.php</PostURL>
<UseSSL>F</UseSSL>
<PostPort>80</PostPort>
<AuthToken>myToken</AuthToken>
<PostRate>1</PostRate>
<SSLKey>NOT IMPLEMENTED</SSLKey>
</ted500ActivationResponse>

dannyted

  • Jr. Member
  • **
  • Posts: 56
  • Karma: +0/-0
    • Energy Monitor Blog
Re: postData.php question
« Reply #3 on: June 01, 2011, 07:39:12 AM »
That is all correct what you have showed me so far.  Not to ask a stupid question, but did you have the post server set to your domain?
<ted500ActivationResponse>
<PostServer>yourdomain.org</PostServer> <----this needs to be your domain?
<PostURL>/postData.php</PostURL>
<UseSSL>F</UseSSL>
<PostPort>80</PostPort>
<AuthToken>myToken</AuthToken>
<PostRate>5</PostRate>
<SSLKey>NOT IMPLEMENTED</SSLKey>
</ted500ActivationResponse>

By the way the reason I asked about your server is because I had some weirdness on a Windows IIS7 server where I had no issues on a Linux Apache server.

Did you see this post I made about my troubles?

http://www.theenergydetectiveforums.com/index.php/topic,100.msg684.html#msg684
« Last Edit: June 01, 2011, 07:44:50 AM by dannyted »
My Energy Blog - http://energymonitorblog.com
     --A site dedicated to discussing power saving information.

My Personal Blog - http://dannymullen.net

MyTed5000 - http://myted5k.com/danny/
     --Live Data from my ted5000

Like me on Facebook
http://www.facebook.com/pages/EnergyMonitorB

devguy

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: postData.php question
« Reply #4 on: June 02, 2011, 03:49:41 AM »
hey danny,
thanks for the response. I did have the post server switched.
my boss said he got it to work on his computer with the same set up but I can't. So maybe something's wrong with my local setup.

dannyted

  • Jr. Member
  • **
  • Posts: 56
  • Karma: +0/-0
    • Energy Monitor Blog
Re: postData.php question
« Reply #5 on: June 02, 2011, 05:54:47 AM »
That is similar to the problem I had.  It worked on my dev server but not on my shared hosting accout.
My Energy Blog - http://energymonitorblog.com
     --A site dedicated to discussing power saving information.

My Personal Blog - http://dannymullen.net

MyTed5000 - http://myted5k.com/danny/
     --Live Data from my ted5000

Like me on Facebook
http://www.facebook.com/pages/EnergyMonitorB