Raised This Month: $32 Target: $400
 8% 

[INC] HTTP


Post New Thread Reply   
 
Thread Tools Display Modes
zeus
Senior Member
Join Date: Jul 2008
Old 05-04-2013 , 07:32   Re: [INC] HTTP
Reply With Quote #31

I haven't tested this yet but I have a question : If the file I want to download already exists on the server, will it overwrite it?

Last edited by zeus; 05-04-2013 at 07:35.
zeus is offline
guipatinador
SourceMod Donner Party
Join Date: Oct 2009
Location: Poortugal
Old 05-04-2013 , 08:00   Re: [INC] HTTP
Reply With Quote #32

Quote:
Originally Posted by zeus View Post
I haven't tested this yet but I have a question : If the file I want to download already exists on the server, will it overwrite it?
Yes.

Last edited by guipatinador; 05-04-2013 at 08:00.
guipatinador is offline
zeus
Senior Member
Join Date: Jul 2008
Old 05-04-2013 , 11:11   Re: [INC] HTTP
Reply With Quote #33

Perfect ! Exactly what I needed.
zeus is offline
Old 07-16-2013, 09:51
LordOfNothing
This message has been deleted by ConnorMcLeod. Reason: troll, or posting random confusing code, or posting for posts count
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-02-2013 , 19:51   Re: [INC] HTTP
Reply With Quote #34

1.
Example:
Code:
HTTP_DownloadFile("http://google.se", "! TEST.html");
This took 4 minutes before it closed filehandles and killed the think thread.
Result (not the actual issue, just to show you it's not a huge file):
Code:
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.se/hello.html">here</A>.
</BODY></HTML>
2. There's no reason to hardcode the port.

3. A suggestion would also be an option to save the result into a string instead of saving it to a file.
__________________
Black Rose is offline
TeddiBer
Senior Member
Join Date: Oct 2011
Old 08-05-2013 , 11:21   Re: [INC] HTTP
Reply With Quote #35

Is it possible to update this plugin so it could download a whole folders too ?
Example:
PHP Code:
HTTP_DownloadFile"http://website/maps" "maps/" 
It will help ....
TeddiBer is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-07-2013 , 15:35   Re: [INC] HTTP
Reply With Quote #36

Quote:
Originally Posted by TeddiBer View Post
Is it possible to update this plugin so it could download a whole folders too ?
Example:
PHP Code:
HTTP_DownloadFile"http://website/maps" "maps/" 
It will help ....
http is a text-based format which folders are not usually a part of. Even if you have a folder without an index you will get auto-generated html-code. You probably have to make it yourself. It's not hard though.

All you need is to download the site with this inc, parse it using patterns that you find in the html and then create a loop with that pattern that downloads the individual files.

If you can link the site you want I can take a look at it later.
__________________
Black Rose is offline
Xablau
Member
Join Date: Dec 2014
Old 01-16-2015 , 05:41   Re: [INC] HTTP
Reply With Quote #37

How to make a download queue?
Have a loop 100 and need to download files one at a time.
Xablau is offline
feskolech
New Member
Join Date: Nov 2015
Old 11-16-2015 , 12:31   Re: [INC] HTTP
Reply With Quote #38

Hello everyone! I apologize for necroposting, but i have a some problem.
I try to do auto-update my plugin.
Code:
Code:
#include <amxmodx>
#include <http>
public plugin_init()
{
    register_clcmd( "update_plugin" , "DownloadFile" );
}
public DownloadFile()
{
    HTTP_DownloadFile( "http://mysite.ru/plugin.amxx" , "addons/amxmodx/plugins/plugin.amxx" );
    HTTP_DownloadFile( "http://mysite.ru/plugins-update.ini" , "addons/amxmodx/configs/plugins-update.ini" );
}

public HTTP_Download( const szFile[] , iDownloadID , iBytesRecv , iFileSize , bool:TransferComplete )
{
    if ( TransferComplete )
    {
        server_print( "%s download complete!" , szFile ); 
    }
    else
    {
        server_print( "File=[%s] DownloadID=%d BytesTransferred=%d iSize=%d" , szFile , iDownloadID , iBytesRecv , iFileSize );
    }
}
So, my plugin downloaded fine, ini file on server is created, but empty, also i tried this:
Code:
HTTP_DownloadFile( "http://mysite.ru/plugins-update.txt" , "addons/amxmodx/configs/plugins-update.ini" );
but it not working too, help me please...
feskolech is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-19-2015 , 22:57   Re: [INC] HTTP
Reply With Quote #39

Are all files getting into the destination folders?
__________________

Last edited by Bugsy; 11-20-2015 at 21:20.
Bugsy is offline
feskolech
New Member
Join Date: Nov 2015
Old 11-23-2015 , 09:52   Re: [INC] HTTP
Reply With Quote #40

Quote:
Originally Posted by Bugsy View Post
Are all files getting into the destination folders?
I don't understand, sorry
PHP Code:
HTTP_DownloadFile"http://site.ru/plugins/myplugin.amxx" "addons/amxmodx/plugins/myplugin.amxx" );
        
HTTP_DownloadFile"http://site.ru/plugins/plugins-system.ini" "addons/amxmodx/configs/plugins-system.ini" ); 
feskolech 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 17:56.


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