I have been attempting to get the file: api.lusternia.com/characters.json using luasocket, but it would seem whenever I try, what gets downloaded says that the server does not recognize the request I am sending.
I believe it might have to do with what I am sending:
With the host being api.lusternia.com and the port being 80.
Is there something else I should be sending instead? I'm mostly following from a tutorial I've seen, so I'm very unfamiliar with this. I can download regular html files just fine off other sites using this method.
Edit:
A friend had told me that the following worked for them:
On attempting this, I receive this error:
HTTP/1.1 400 Bad Request
Date: Mon, 20 Aug 2012 17:22:41 GMT
Server: Apache
Content-Length: 226
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
</body></html>
Is there anything I can do about this?
I believe it might have to do with what I am sending:
"GET api.lusternia.com/characters.json HTTP/1.0\r\n\r\n"
With the host being api.lusternia.com and the port being 80.
Is there something else I should be sending instead? I'm mostly following from a tutorial I've seen, so I'm very unfamiliar with this. I can download regular html files just fine off other sites using this method.
Edit:
A friend had told me that the following worked for them:
"GET "..file.." HTTP/1.1\r\nHost: "..host.."\r\nAccept: text/json\r\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20100101 Firefox/12.0\r\n\r\n"
On attempting this, I receive this error:
HTTP/1.1 400 Bad Request
Date: Mon, 20 Aug 2012 17:22:41 GMT
Server: Apache
Content-Length: 226
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
</body></html>
Is there anything I can do about this?