Announcement

Collapse
No announcement yet.

Problem When Attempting to POST with TCPLink

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Problem When Attempting to POST with TCPLink

    Hey All-
    I've hit a roadblock when trying to post to a server. I've made a child of the TCPLink class with the following Opened() even (the GET function works)

    Code:
    event Opened()
    {  
        //let the php file know what's coming
        WorldInfo.Game.Broadcast(self, "REQUEST TEXT: " $ RequestText);
        if(bGetData){
            SendText("GET /"$TargetPath$"?"$RequestText$" HTTP/1.0"$chr(13)$chr(10));
        }else{
            SendText("POST /"$TargetPath$" HTTP/1.0"$chr(13)$chr(10));
            WorldInfo.Game.Broadcast(self, "SENDING POST");
            `log("---------------------------SENDING POST-------------------------");
        }
        SendText("Host: "$TargetHost$chr(13)$chr(10));
        SendText("User-Agent: HTTPTool/1.0"$Chr(13)$Chr(10));
        SendText("Content-Type: application/x-www-form-urlencoded"$chr(13)$chr(10));
        SendText("Content-Length: "$len(RequestText)$Chr(13)$Chr(10));
        SendText(chr(13)$chr(10));
        //send securitykey, command and params for php to use
        SendText(RequestText);
        SendText(chr(13)$chr(10));
        SendText("Connection: Close");
        SendText(chr(13)$chr(10)$chr(13)$chr(10));
    }
    I know it attempts to send the post (I see the Broadcast and log messages) but the log displays this error:
    Code:
    [0042.56] ScriptLog: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
    <title>301 Moved Permanently</title>
    </head><body>
    <h1>Moved Permanently</h1>
    <p>The document has moved <a href="http://hosting.zymic.com/forum-spam">here</a>.</p>
    </body></html>
    Any idea of what I'm doing wrong?

    #2
    The server has accepted your request and sent you a redirect response. If you check the HTTP response headers, you should see a status code of 301 and a "Location:" header with the URL you are supposed to load after submitting your post.
    I recommend you read up on the HTTP documentation for details.

    Comment

    Working...
    X