Raised This Month: $37 Target: $400
 9% 

help make the plugin send demo recording post request


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pmaster
New Member
Join Date: Jan 2019
Old 01-12-2019 , 15:29   help make the plugin send demo recording post request
Reply With Quote #1

I am new to this, I can not find ready examples.
my code:

Code:
public Action Command_Push_Demo(args){
	decl String:sDemoFile[PLATFORM_MAX_PATH], String:toURL[192];
	if (args < 2)
	{
		PrintToServer("[POST] error. ");
		return Plugin_Handled;	
	}	
	
	GetCmdArg(1, sDemoFile, sizeof(sDemoFile));
	GetCmdArg(2, toURL, sizeof(toURL));
	Handle file = OpenFile(sDemoFile,"r");
	if(file == INVALID_HANDLE)
	{
		PrintToServer("[POST] WARNING - %s not found", sDemoFile);
		return;
	}
	
	System2HTTPRequest request = new System2HTTPRequest(HttpResponseCallback, "http://example.com/recieverdemoscript"); 
	
	//????????
	//I do not have enough knowledge here
       
	request.POST();  
	
	PrintToServer("sending %s to %s ",sDemoFile, toURL);
	
	
	
	
return Plugin_Handled;	
}
pmaster is offline
arcticx2
Member
Join Date: Nov 2011
Old 01-13-2019 , 09:51   Re: help make the plugin send demo recording post request
Reply With Quote #2

i don't think you told us everything we need to know ! is this plugin sending demo from the host , or the player it self ?

for players i dont think you can do this even with fake commands because of the limits :-? so ....

for host , https://forums.alliedmods.net/showthread.php?t=223024

PHP Code:
SteamTools is the simplest.


SendRequest() {
    new 
HTTPRequestHandle:request Steam_CreateHTTPRequest(HTTPMethod_POST"http://www.example.com"); // Create the HTTP request
    
Steam_SetHTTPRequestGetOrPostParameter(request"herp""derp"); // Set post param "herp" value to "derp"
    
Steam_SendHTTPRequest(requestOnRequestComplete); // Send the request
}

public 
OnRequestComplete(HTTPRequestHandle:requestbool:successfulHTTPStatusCode:status) {
    
decl String:response[1024];
    
Steam_GetHTTPResponseBodyData(requestresponsesizeof(response)); // Get the response from the server
    
Steam_ReleaseHTTPRequest(request); // Close the handle

did you try this ?

*edit*

Check this too !

https://forums.alliedmods.net/showthread.php?p=1377229

Upload a file to a FTP server:

PHP Code:
System2FTPRequest ftpRequest = new System2FTPRequest(FtpResponseCallback"ftp://example.com/test.txt");
ftpRequest.AppendToFile true;
ftpRequest.CreateMissingDirs false;
ftpRequest.SetPort(21);
ftpRequest.SetProgressCallback(FtpProgressCallback);
ftpRequest.SetInputFile("test.txt");
ftpRequest.StartRequest(); 

Last edited by arcticx2; 01-13-2019 at 13:58.
arcticx2 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:14.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode