HTTP...
#1

pawn Код:
public nGlobalMessage(playerid, server[], message[])
{
    HTTP(playerid, HTTP_GET, "url/nc/index.php?message=sgsdgsgsfdg", "", "nGlobal_Result");
}
public nGlobal_Result(index, response_code, data[])
{
    new
        buffer[ 128 ];
    if(response_code == 200)
    {
        format(buffer, sizeof(buffer), "The URL replied: %s", data);
        printf(buffer);
    }
    else
    {
        format(buffer, sizeof(buffer), "The request failed! The response code was: %d", response_code);
        printf(buffer);
    }
}
returns HTTP_ERROR_MALFORMED_RESPONSE everytime, the index file just echoes "SUCCESS".

What's the issue? It's got me mega confused.
Reply
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
It's kind of hard to say without seeing at least the HTML output (if not the PHP itself).
Код:
<?php
	echo("SUCCESS");
?>
I haven't even coded anything yet, I'm just trying to get it to read it first..
Reply
#3

What webserver are you using?
Try:
PHP код:
<?php
    header
("Content-type: text/html");
    echo(
"SUCCESS");
?>
Also try this:
- Open a telnet:
Код:
telnet yoururl 80
- Type these lines, delimited by enters:
Код:
GET /path/index.php HTTP/1.1
Host: yoururl.com
User-Agent: Mozilla
Connection: close
(on the last line, send two enters)
- Copy and paste the whole output from the server.
- Do the above steps, but with HTTP/1.0 instead of HTTP/1.1
Reply
#4

I'm getting unrecognised command on w7 trying to do that, the url is http://nornitus.info/nc/index.php it's windows server 2008 using the latest version of xampp.

Cheers
Reply
#5

Weird....
tested with netcat, and an example filterscript.. it gives 6 as response code. Using 0.3d RC2.
Quote:

HTTP/1.1 200 OK
Date: Wed, 26 Oct 2011 15:13:38 GMT
Server: Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1
X-Powered-By: PHP/5.3.8
Content-Length: 7
Connection: close
Content-Type: text/html

SUCCESS

I tried to write a response manually:
Quote:

HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 7

When I pressed enter twice (to start data sending), the callback fired, end the socket got closed by SAMP.

Seems like SA-MP HTTP closes the socket before data arrives.
Trying to get it working, but I can't even do that.
Reply
#6

Quote:
Originally Posted by KoczkaHUN
Посмотреть сообщение
Weird....
tested with netcat, and an example filterscript.. it gives 6 as response code. Using 0.3d RC2.


I tried to write a response manually:

When I pressed enter twice (to start data sending), the callback fired, end the socket got closed by SAMP.

Seems like SA-MP HTTP closes the socket before data arrives.
Trying to get it working, but I can't even do that.
I'm extremely confused myself man, I tried hosting it locally as well with no luck..
Reply
#7

What SA-MP version are you using?
Reply
#8

0.3d, I also tried the url automation.whatismyip.com/n09230945.asp with no luck either, could it be a 0.3d issue?
Reply
#9

0.3d RC (what)?
Reply
#10

Oh my bad, 0.3d RC6.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)