Blockland Forums > Modification Help
HTTPObject PHP parameters
(1/4) > >>
Bauklotz:
Okay, from the beginning. I am locally hosting a website and I have a PHP script which contains this:

--- Code: (PHP) ---<?php
    file_put_contents("./stuff.txt",$_GET["variable"]);
?>

--- End code ---

And then in TS, I do this:

--- Code: (TorqueScript) ---new HTTPObject(Intrastuff);
Intrastuff.get("localhost:80","/filename.php?variable=nothing");

--- End code ---

Okay, on the server, before running the TS code, there is no file except filename.php
Now I run the TS code, and a file called stuff.txt is created. I open it, and the contents are just blank, "".
I tried making it echo the $_GET["variable"], but its still just "". I'm guessing this is a problem with TS.

How would I properly send a request of the PHP script, but passing arguments?
Bauklotz:
Also, HTTPObjects have a .post function, but the arguments dont make sense.
.post(Address, RequestURI, query, post);
Bauklotz:
Bump due to great importance.
Plornt:
I think you should try TCP sockets
Kalphiter:
When trying your code, I got this:
GET /filename.php?variable=nothing
This seems to correct, try checking the response first by declaring this function right after you create the HTTPObject:

--- Code: (TS) ---function Intrastuff::onLine(%this, %line)
{
    echo(%line);
}
--- End code ---
Navigation
Message Index
Next page

Go to full version