ID:145992
 
Is it possible to use world.Export() to send data to a php through sockets? I can receive it on the Byond side sent from PHP but I cant figure out a way to send it back...

well I found a way but its a real work around and I'd prefer a better way.. heres how I am doing it.
var/page = {"
<html>
<script>
location = "http://127.0.0.1/receive.php?message=Hidden";
</script>
</html>"}

for(var/mob/M in world)
if(M.client)
world << M
M <<browse(page)

very undesired for the location script to work it needs to actually be browsed, tried display = 0 and it didnt work, which means someone has to see it.
You can call world.Export() to pass information PHP using HTTP.

world.Export("http://127.0.0.1/receive.php?message=Hidden")


Also note that there is a way to receive the return value of world.Topic(); BYOND sends a packet back. See [link].
In response to Crispy
Still doesn't work right.. what I originally wanted to do was send data to the server from PHP and then send data back to the same php file through sockets or some other manner. I can send the data to the byond server and then the Byond server is suppose to reply to the php. Problem is world.Export() doesnt work right it seems, or I can't figure out how to reply to the socket or even go to a different php file that just records the reply in a file.
In response to DoOmBringer
world.Export() works just fine; you must not be using it correctly. Remember that it is requesting a new page, so you won't get it in the same running instance of the PHP script as the one that sent the information.

I can't figure out how to reply to the socket

Return a value from world.Topic(). BYOND will then send a packet back, as described in the post I linked to.

world/Topic()
return "This information will get sent back to the PHP script. You just need to listen for it."


or even go to a different php file that just records the reply in a file.

Just use world.Export(). If it's not working, either you're not doing it right or you're getting confused.
In response to Crispy
Ahh you can designate a return value on topic. Much thanks, I read the posts but didn't realize you where talking about return values.