Jump to content

Fixing fetchRemote on client side...


xXMADEXx

Recommended Posts

Hi guys. So, as some of you may know that fetchRemote you can get files from web servers blah blah blah... Well, I did a test.. And when i did it on the server side I wrote this code:

    addEventHandler ( "onResourceStart", resourceRoot, function ( ) 
        fetchRemote ( "scgmta.net", callback ) 
    end ) 
     
    function callback ( data, errors ) 
        local file = fileOpen ( 'data.txt' ) or fileCreate ( 'data.txt' ) 
        fileWrite ( file, "Errors: "..errors.."\n\nData:\n"..data ) 
        fileClose ( file ) 
    end 

And it executed 100% perfect... Then i tried it on the client side:

addEventHandler ( "onClientResourceStart", resourceRoot, function ( ) 
    fetchRemote ( "scgmta.net", callback ) 
end ) 
  
function callback ( data, errors ) 
    local file = fileOpen ( "d.txt" ) or fileCreate ( "d.txt" ) 
    fileWrite ( file, "Errors: "..errors.."\n\nData:\n"..data ) 
    fileClose ( file ) 
end 

And this is what I got:

Errors: 1004 
  
Data: 
ERROR 

So, I asked Castillo and he says that the web server must be hosted on the same PC that the MTA server is hosted on. I think that fetchRemote on client side should be able to do what the server side does (so the web server dosn't have to be hosted on the same computer.)

Regards, xXMADEXx

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...