HTTP with Sockets

Started by vcmptr, Aug 08, 2015, 12:43 AM

Previous topic - Next topic

vcmptr

Can I get HTTP page content using sockets? I don't know how to use socket but if it's possible I will try learn use sockets.
My English is not good.

PlayerX

Yes...

http://wiki.vc-mp.org/wiki/Query_Mechanism

example:

$res = new VCMPQuery("31.220.22.42", 8192);
$info = $res->getServerInfo();
echo $info['hostname'];
If some see me on a server and see that I'm not from Argentina, is an impostor >_>.
Playing since 9 years.

ysc3839

Quote from: PlayerX on Aug 08, 2015, 01:31 AMYes...

http://wiki.vc-mp.org/wiki/Query_Mechanism

example:

$res = new VCMPQuery("31.220.22.42", 8192);
$info = $res->getServerInfo();
echo $info['hostname'];

He means use the socket plugin to get a html page.

ysc3839

A very simple HTTP request.
function HTTP()
{
Socket <- NewSocket("DataFunc");
Socket.SetNewConnFunc("ConnFunc");
Socket.Connect("www.example.com", 80)
}

function DataFunc(data)
{
print(data);
}

function ConnFunc()
{
local request = @"GET / HTTP/1.1
Host: www.example.com

";
Socket.Send(request);
}

KAKAN

Hmm, it'll help me too!
oh no

vcmptr

Quote from: ysc3839 on Aug 08, 2015, 06:42 AMA very simple HTTP request.
function HTTP()
{
Socket <- NewSocket("DataFunc");
Socket.SetNewConnFunc("ConnFunc");
Socket.Connect("www.example.com", 80)
}

function DataFunc(data)
{
print(data);
}

function ConnFunc()
{
local request = @"GET / HTTP/1.1
Host: www.example.com

";
Socket.Send(request);
}
Thanks ysc! :)
My English is not good.