Hello. I'm trying to make an version check via github, but can't seem to get connected to github:
https://raw.githubusercontent.com/Gu...sion_check.txt
PHP Code:
#include <amxmodx>
#include <sockets>
new g_pSocket;
#define SCRIPT_NAME "/GuskiS/Trouble-in-Terrorist-Town/master/version_check.txt"
#define REMOTE_HOST "raw.githubusercontent.com"
public plugin_init()
{
set_task(5.0, "connect_web");
}
public connect_web()
{
new error;
g_pSocket = socket_open(REMOTE_HOST, 443, SOCKET_TCP, error);
if(g_pSocket > 0)
{
new string[140];
formatex(string, charsmax(string), "GET %s HTTP/1.1^nHost: %s^n^n", SCRIPT_NAME, REMOTE_HOST);
socket_send(g_pSocket, string, charsmax(string));
read_web();
}
else
{
switch(error)
{
case 1: server_print("Error creating socket");
case 2: server_print("Error resolving remote hostname");
case 3: server_print("Error connecting socket");
}
}
}
public read_web()
{
new text[2048];
socket_recv(g_pSocket, text, charsmax(text));
server_print("^n%s", text);
server_print("%s^n", text[254]);
}
Output:
Code:
HTTP/1.1 400 Bad Request
Date: Sat, 08 Nov 2014 15:10:45 GMT
Server: Apache
Content-Length: 362
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 />
Reason: You're speaking plain HTTP to an SSL-enabled server port.<br />
Instead use the HTTPS scheme to access this URL, please.<br />
Is it even possible?
__________________