XMLHttpRequest does not return anything

Status
Not open for further replies.

sportsbet35

New Member
Messages
4
Reaction score
0
Points
0
Hi all,

I'm new to X10Hosting. I have the following piece of codes that always works for me on other host servers but not here on X10Hosting. Does anybody here know why the codes will only work with "url=http://www.google.com/" but not with some other URLs like www.yahoo.com or www.msn.com? Is there by any chance that X10Hosting happens to block them for some reason?

Thank you very much.

P.S.: "GetFile.php" is a very small external program written in cURL that allows cross-domain access.


Code:
var XMLHttpRequest;
 
if (window.XMLHttpRequest)
   HTTPrequest = new XMLHttpRequest();
else
   try {
      HTTPrequest = new ActiveXObject("MSXML2.XMLHTTP.3.0");   // for older Internet Explorer versions before 7.0
   }
   catch (exception) {
      window.alert("Error: XMLHTTP not supported by current browser.");
      return (-1);
   }
 
XMLHttpRequest.open("GET","[COLOR=darkgreen]GetFile.php[/COLOR]?url=http://[COLOR=red]www.google.com[/COLOR]/");
XMLHttpRequest.onreadystatechange = function()
{
   if (XMLHttpRequest.readyState == 4 && XMLHttpRequest.status == 200)
      window.alert("[" +XMLHttpRequest.responseText.substr(0,500) +"]");
 
}
XMLHttpRequest.send(null);
 

lemon-tree

x10 Minion
Community Support
Messages
1,420
Reaction score
46
Points
48
There are three issues here:
1. The most significant issue is that GetFile.php doesn't exist on your account, so the request is returning a 404 error every time and then failing

2. GetFile.php could be counted as a proxy and may cause an account suspension under the relevant clause of the terms of service.

3. Port 80 is closed on all the free servers, meaning the cURL requests in GetFile.php would be blocked and would error out or return nothing.
 

sportsbet35

New Member
Messages
4
Reaction score
0
Points
0
Hi lemon-tree,

Just as I suspected: port 80 is being blocked by X10Hosting - thank you very much for being very thorough in answering my question. (sigh ...) This would put me totally out of business since my site depends very much on the data it gets from another site. I'm going to close this thread now and again appreciate your reply.

---------- Post added at 08:36 AM ---------- Previous post was at 08:06 AM ----------

Hi all,

Does anybody know how to close this thread? I'm looking for the link to close it but I couldn't find it anywhere on the page. If you can close the thread, please close it for me.

Thank you very much.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Note that the block is only on the free hosts (due to abuse by phishers and other-ne'er-do-wells). If the site is commercial, consider paid hosting, which allows outgoing connections to port 80, as well as being more performant.

As for closing the thread, an admin will have to do it. (it should show up in "Thread Tools", if anywhere).
 

carl6969

Community Support Team
Community Support
Messages
6,874
Reaction score
206
Points
63
Closing thread at request of OP
 
Status
Not open for further replies.
Top