Home AMX User Forum NetLinx Studio

POST Method HTML

Has anyone successfully coded the ability to connect to a website that requires a POST method with variable data?

I am having a difficult time and I think most of my problems are coming from the way length_array and various string operations are being handled by NetLinx. Basically, I think I need to get the length of the data being submitted and post it before I start sending the data. This means that I need to store the entire output string, then count length, then send the string.

To aid in troubleshooting, I have every line write to a file on the processor immediately following the send_string dvWeb statement. I am getting very odd results and I am trying many different techniques. I have tried using length_array, length_string (even tho it is supposed to be the same), find_string (searching for $0A), and I am about to create my own find_string routine. I have a variable that is 10000 large (well under the 16k-ish problem point). Data has yet to get much bigger than 600, but there is a good chance that it will be in the 5-6k range or larger at times.

Anyone have any suggestions on how to prep the data for transmission and store it? I know there is a reliable way, I am just failing to find it today.

Jeff

Comments

  • Joe HebertJoe Hebert Posts: 2,159
    Spire_Jeff wrote: »
    I am having a difficult time and I think most of my problems are coming from the way length_array and various string operations are being handled by NetLinx. Basically, I think I need to get the length ...
    Can you elaborate? Do you mean the reported length is not what you think it should be? Is Netlinx handling things differently than you expected?
  • ericmedleyericmedley Posts: 4,177
    I may not be understanding this correctly...

    but, I've found that with any kind of web interaction, I tend to be very agressive in how strings coming back and/or going out are handled.

    For example, I will almost always take incoming data and postpend it to a larger buffer and wait a good long time before acting on it. When I postpend a chunk I put in my own delimiter and when I'm sure we're good 'n done, will go through and rebuild the entire string taking out my delimeters. It is then that I get all the array length stuff and what not.

    Here again, I don't know if I'm helping or not. But more info on what you're doing might be helpful for my addled brain...
  • Also, can you post code of how you're setting the values in the char array? This all made me think of one of Joe's posts about SET_LENGTH_ARRAY here: http://www.amxforums.com/showpost.php?p=25899&postcount=8.

    --John
  • bcirrisibcirrisi Posts: 148
    I did something with post commands in the mobile web pages I made, might be worth looking at...

    http://www.amxforums.com/showthread.php?t=5329
  • Spire_JeffSpire_Jeff Posts: 1,917
    Working with it further, I think I found part of my problem. I was using a stack_var to hold the string that I was creating. I changed to a volatile global var and it seemed to start working a little better. The variable is only used within the function I declared it, but I was getting odd values using length_array().

    I tried looking at the mobile web app, but I am still in timeout for not completing all of my ACE recerts on time. If I don't make any progress tonight, maybe I'll send you a PM and see if you can just copy and paste the post to me in a PM :)

    To elaborate on the problem... I am sending out a POST request to a web page that I created. I have the GET request working fine, but I was trying to avoid the delays that occur when I have more than one submission within a 2 second window. (the approximate timeout time from the web server). I have no idea if the correct data is being sent because of the difficulties in monitoring IP comms. I don't have a switch that I can send all data to my PC, nor have I looked at putting my network card in promiscuous mode to sniff the data. I am relying on posting the data to a file and viewing it after the fact, but that file is not containing the information that I think should be there. I am pretty sure that some of the data is actually being sent correctly to the webserver, but not saved in the file because of the need to specify how many chars to write to a file.

    I think I am close, but I will post more helpful info if I am unable to make any further progress.

    Jeff
  • Spire_JeffSpire_Jeff Posts: 1,917
    Ok, I have it working as well as the GET procedure now. I think moving it from STACK_VAR to a global var fixed the problem I was having with NetLinx. I also fixed a problem I had with the data I was sending, so I may have been the only reason for the failure :)

    Jeff
  • Spire_JeffSpire_Jeff Posts: 1,917
    Thanks for letting me vent here.... Venting some of my frustrations (even tho I didn't click send on all of them :) ) helped me move on and got the brain back on track and now everything is working the way I thought it should (not necessarily the way I typed it originally :) ).

    A couple of the replies got me thinking along the correct lines again and it is much appreciated.

    Jeff
Sign In or Register to comment.