Shymus Roffo Posted May 29, 2012 Share Posted May 29, 2012 i have been experimenting with these two events and wondering if there are better alternatives to remote data with PHP functions... I am begining to learn php and i do not know how to send http requests and wanted to know how to do it...XML-RPC is a pain to figure out and remember.. If you can please help. Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted May 29, 2012 Share Posted May 29, 2012 You want an HTTP request from a webserver to SL? Or a request from SL to a webserver? Link to comment Share on other sites More sharing options...
Shymus Roffo Posted May 29, 2012 Author Share Posted May 29, 2012 webserver to SL Link to comment Share on other sites More sharing options...
Sassy Romano Posted May 29, 2012 Share Posted May 29, 2012 one of your big potential challenges is that many hosting companies block the required inbound TCP port to SL. It's 12046 if I remember correctly, check but that would cause you much frustration if your code was correct and nothing happened. Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted May 29, 2012 Share Posted May 29, 2012 Sassy points out an important point. Not too many hosting providers allow outward communication on odd ports. Apart from that, you'll find a simple example (LSL and PHP) at the ende of this page, that you can try out and study. Link to comment Share on other sites More sharing options...
Shymus Roffo Posted May 29, 2012 Author Share Posted May 29, 2012 How can i figure out what ports are avaliable to me from the hosting company? do i have to contact the company or can i just use phpinfo() ? Link to comment Share on other sites More sharing options...
Shymus Roffo Posted May 29, 2012 Author Share Posted May 29, 2012 i also have managed to get XML-RPC to send data but i was told that there is an easier way without have to use remote data and could use http response instead. Link to comment Share on other sites More sharing options...
Sassy Romano Posted May 29, 2012 Share Posted May 29, 2012 shymus Roffo wrote: How can i figure out what ports are avaliable to me from the hosting company? do i have to contact the company or can i just use phpinfo() ? You can just try your code and if you think it will work see what happens, or you could just ask the hosting company if they restrict outbound connections on ports other than port 80 (or any others) Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted May 29, 2012 Share Posted May 29, 2012 Actually, there are at least 3 points of failure: fsock isn't enabled - you can see that in the phpinfo() the port is blocked - the request will time out you provided a wrong url for the LSL script in your php script - you'll get an error message in the webpage (in the example I pointed to) that the cap wasn't found. This at least means, the port is open Link to comment Share on other sites More sharing options...
Sassy Romano Posted May 29, 2012 Share Posted May 29, 2012 Darkie now raises another fun point and that's when a prim with a script gets a URL, that URL is valid until the script resets or the object is re-rezzed OR the region restarts. Region restarts need to be handled if you expect your web host to send data to the inworld prim at any point as it will need a current URL. Similarly, if the prim happens to be a worn item such as a hud, you'll need to handle the rez situation on region change or teleport. It's all fun! Link to comment Share on other sites More sharing options...
Shymus Roffo Posted May 29, 2012 Author Share Posted May 29, 2012 Ok i was planning on using it as a server so people can browse a store on a website or pick an item from it and have it delivered to them in world. so far it works. Link to comment Share on other sites More sharing options...
Sassy Romano Posted May 29, 2012 Share Posted May 29, 2012 Ah well in that case, you might be able to be a bit clever and not get into difficulty with initiating outbound communications. Depending on how you do it, your web browser can make the request to the inworld delivery server and that won't have any ports restricted. You would need to have appropriate security controls in place though with this model to avoid any vulnerabilities that permitted someone to run local scripts in a browser that then commanded a delivery server to hand out free products and i'm not saying it's the best model, just something that you *might* be able to work with if blocked ports is an issue. Link to comment Share on other sites More sharing options...
Talia Davidov Posted May 29, 2012 Share Posted May 29, 2012 if you need to work around the changing URL that Sassy pointed out a couple of posts ago, there is a workaround I posted in this thread about using a third party service to keep the location of your inworld prim up to date. Not sure it would be needed in your case since the inworld server communicates to the out of world server first if I am following correctly. But just in case there it is. Link to comment Share on other sites More sharing options...
Sassy Romano Posted May 29, 2012 Share Posted May 29, 2012 If it's a vending solution then at some point it will be making a call from the webhost to the inworld delivery server. Given that it only has to communicate with those (by the sound of it), there's only a need to maintain a sql table of a handful of delivery servers so shouldn't be a problem to update those when the URL changes. There'll be a database anyway so all good as far as I can see. Link to comment Share on other sites More sharing options...
Talia Davidov Posted May 29, 2012 Share Posted May 29, 2012 *Nods . . .Sounded like that to me too, but thought it wouldn't hurt to post the other. Link to comment Share on other sites More sharing options...
Shymus Roffo Posted May 30, 2012 Author Share Posted May 30, 2012 its not really like a vendor, It is a box that holds stuff for a roleplay store. and you can use virutal roleplay money to purchase stuff in the store. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now