View Single Post
  #1  
Old 12-30-2005, 02:47 PM
Riot Riot is offline
Delteria Management
Join Date: Nov 2003
Location: Seminole County, Florida
Posts: 280
Riot is on a distinguished road
HTTP Requests and hosts

I noticed several revisions ago that some new request commands were added on the client-end, one of which involves HTTP requests. This is great, but it does not seem to be sending the Host to the server, which can cause problems with some web hosts.

The code I'm using:
HTML Code:
//#CLIENTSIDE
function onCreated()
{
  this.request = requesthttp("delteria.com", 80, "/test.txt");
  setTimer(0.1);
}

function onTimeout()
{
  // Check if the file has finished downloading
  if (this.request.downloadcomplete)
  {
    // The file has finished downloading, output data to console
    for (data: this.request.data)
      echo(data);
  }
  else
  {
    // File hasn't finished downloading yet, wait another 0.1 seconds
    // and check again.
    setTimer(0.1);
  }
}
This returns a 404 error, and if I change /test.txt to /index.html, it returns cPanel's "no website configured" page (Which can be seen here.) rather than http://delteria.com/test.txt. I can work around it by doing requesthttp("delteria.com", 80, "/~delteria/test.txt"); but it would still be nice if this was looked into.

I was also wondering if/when this will be supported serverside; and I noticed a "requestmysql" command as well, but have no clue how to use it. I tried to assume params and output variables/functions, but only got the defaults.
Reply With Quote