Jump to content

Darkie Minotaur

Resident
  • Content Count

    1,663
  • Joined

  • Last visited

Everything posted by Darkie Minotaur

  1. I usually use some kind of simple database on my outworld servers to which the inworld objects repoort their URLs whenever a restart, script restart ... occurs
  2. You should be a little more specific about what you want to do or achieve. I don't understand what you really mean.
  3. You can look at the examples - there is also one that uses php.
  4. Did you try with: $USE_APACHE_HEADERS = FALSE; ?
  5. I don't know what you used that didn't work - test is with TRUE - if that doesn't work, try FALSE
  6. Did you check the example "example wrapper script Both capturing apache headers and global methodes" here? I assume, this solves your problem.
  7. if you get a 404 error, there is something wrong with the URL. Does the request from the script get through? Another thing (which shouldn't be directly related to the 404 error) is that the if you send the parameters after the URL like you seem to do (i.e. starting with a ? after the URL), this will result in a GET request - whereas in the LSL script you use a POST request. I would think that the parameters that you type into the browser contain elements that result in a malformated URL. Let the LSL say the URL and the parameters - then copy and paste theser elements to the browser. This way you can make sure, they are encoded correctly. This should get rid of the 404 error - but it won't get you the result wanted, since you still have the GET vs. POST issue.
  8. Let me see if I get you right: you call an php from a browser - http://myserver.com/sample.php the call should include GET parameters like: http://myserver.com/sample.php?para1=1&para2=2 these parameters get passed by the php by CURL or fopen to a SL object that has a valid URL Where exactely does your problem with the character encoding happen?
  9. I do not fully understand, what you want to do in that test. If you send an URl from a browser, it gets encoded - I guess that's what you refer to when you're saying "not the correct format" - PHP usually handles that automatically.
  10. What you describe sounds sensible. Object in SL requests an URL LSL script in this object sends the URL to a web server where a PHP script stores the URL to some kind of DB (mySQL, text file) PHP retrieves the URL from the DB PHP sends a request to the object using tis URL Somewhere along this workflow, the URL sent to the PHP gets outdated - reasons could be: The DB contains old URLs e.g. the URL does not get updated, or an old URL doesn't get deleted ... The object gets rerezzed (e.g. because it gets tped) but the URL doesn't get updated. The object gets deleted without deleting the URL from the DB. Keeping the URLs of a complex system updated can get pretty painful.
  11. You can't. If I remember right, it's the uuid of the http-listener, as it where.Once the mapping is lost, the http-listener is lost
  12. Does the PHP script try to get the information to be passes back to the script that notifies you by means of http in? It seems to me that the messages you get is the message that SL sends you if http in gets an request for an outdated URL of an object.
  13. You just forgot the closing curly backets } on the second if statement
  14. Just to elaborate on what ObviousAltIsObvious said: The $_GET variable in PHP get populated by the key-value-pairs in the URL of a GET request. You put your values in the body of the HTTP-request, not in the URL, so the $_GET variable in PHP will be empty. The body is used in a POST request to pass the key-value-pairs.
  15. I find XML-RPC a bit sticky - it has never worked very stably for me. I usually use http-in to initiate a communication from a webserver to a scripted object. You have to make sure though that the SL object sends it's current URL to the webserver.
  16. Simply speaking, a php file executes and then closes he HTTP connection - that's what it is made for. The execution is quite fast (usually), so that there is no need to do things after you send the response. There are however ways to let a php file call another php script or some other kind of command - but this can be a bit tricky. One example to do that can be found here. Another trick that is used to evade the timeout problem (e.g. if you are grabbing a large amount of data and write it to a database or if you want to write the contents of a database to a flat file) is to call a php file over and over again till the task is done. In general, you should execute all you want to do as part of the response.
  17. As soon as the script finishes, it closes the communication. You can of course include failure handlers in your script and you should. You already have one for an unexpected end of the file reading. If the execution of the php fails, you'll get a time out or an 499 error. As for the parsing you add separator to the string in php (| is a good one). In LSL, llString2List can be used to parse the string into a list of substrings
  18. Basically, an HTTP conversation consists of one request and one response. The fact that the requested php file may contain several echo commands (or echo commands in a loop), does nor mean several responses are give (and several http_response events are triggered). All echoed text form one response. if, in your example, the amount of text in the text file is (or can be) too long (which is more likely than the php taking too long to read the file), in each response, read one line and then trigger fire a new request until the response contains something telling you that reading the file has reached the end. You actually do that in your sample script: you trigger a new request inside the response. In combination with the php in the other thread woul result in an endless loop - the php would return the complete contents of the file each time. If you run into the problem, that the file is actually too long to be read in 60 seconds, you should consider using a database that contains the bits of information you want to send to SL.
  19. Ah - right. It should be POST. You can also use the GET method - in this case you add the data (again name-value-pairs) to the URL. http://myurl.com/myphp.php?name=MyName&age=20 And on the php side, you use the $_GET array
  20. if Io understand you correctly, you want to pass data from SL to the webserver - right? First you have to decide, what kind of request you are sending - you spicify that in the HTTP_METHOD part of llHTTPRequest. If you make a POST request, you insert name-value pairs into the request body - something like: http_request_id = llHTTPRequest("url", [HTTP_METHOD,"POST",HTTP_MIMETYPE,"text/html; charset=iso-8859-1"], "name=myName&age=20"); On the php side, you can use the $_POST array to read the data: name = $_POST['name'];age = $_POST['age'];
  21. I use Eclipse (with the php extension) since there also is an LSL extension (LSL forge) available - plus it can be used with SVN.
  22. That should be it - apart from a little typo in if (request_id = http_request_id) it should be ==
  23. You cannot download a file to SL from a webserver - however, you can open a textfile with php, read it line by line and then send the text to SL. I don't know where you need help doing this - but here are the general steps with the most important commands: Send a request from SL to your webserver using llHTTPRequest on the webserver, read the file with fopen read the file line by line and make a string with the text - if the text is too long (max. number of bytes is 16384). You read a file you opened with fopen with the fgets command send the string you have built back to SL using the echo command in your LSL script, use the Http response event to get the text. It's in the body of the response
  24. Rolig made a greeter that has most of what you need - you will find it here. You will need to tweak it a bit - again, some of the stuff you may need to add, Rolig posted in the LSL library. Look here. If, however, you are looking for someone to make the script for you, this is the wrong forum - in this case you should post your request here or here.
  25. The example on the page I linked to, communicates in both directions. If you want to use http in, I linked to an example which also communicates in both directions. If you want to look at a working script with MySQL, look at the Silo scripts in the library.
×
×
  • Create New...