Jump to content

Script To Http Post Mime Encoded File?


Recommended Posts

I have a script that runs on many different systems in different locations. The script collects system information that helps us track users and puts the info in a CSV file locally. Because the systems are rather diverse and I cannot guarantee anything other than HTTP access to the web. In a more controlled environment, I might go with NCFTP to deliver the file, but that just cannot be guaranteed.

So, is there a way to have a au3 script do an HTTP PORT of the file to a web site? The CSV file is several hundred lines and I don't want to try a Inetget() appending each line to the URL as that would be hundredsof HTTP GET sessions.

I though about packing in OSQL ( from a MSDE installation ) and doing a BCP type insert directly to a SQL server, but that's also not really what I want.

Basically, I need to deliver a CSV file to a central web site over HTTP with minimal overhead on established ports. It would be nice if there was an Inetpost() function available.

Any ideas?

Thanks,

Tim

Link to comment
Share on other sites

I haven't done this, but it strikes me that WebDAV is what you really want to use. You can do this on XP:

net use f: http://www.yoursite.com/folder passwrd /user:username

You may even be able to use the DriveMapAdd command in AutoIt

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

I cannot guarantee that SMB is supported on their network. Also, what level of encryption and packet signaling makes it impossible. HTTP POST is low level, accepted, simple, common.....but apparently not yet supported in AutoIT.

Tim

Link to comment
Share on other sites

I cannot guarantee that SMB is supported on their network. Also, what level of encryption and packet signaling makes it impossible. HTTP POST is low level, accepted, simple, common.....but apparently not yet supported in AutoIT.

Tim

I believe that SMB only comes into play if you use a UNC style path, but that said, if you do not have full control of the configuration of the systems involved you cannot guarantee that the WebDAV client services will be enabled.

AutoIt does not have explicit support for this, but the beta does support COM and will give you access to interfaces like WinHTTP. Using WinHTTPRequest and its Open and Send methods I expect you can accomplish this.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

  • 2 months later...

I have used the little i386 windows version of cURL for this. The SSL version I use can be found at cURL

the example I'll post about here is from their FAQ page. See Curl Documents(4.3 File Upload POST)

Back in late 1995 they defined an additional way to post data over HTTP. It

is documented in the RFC 1867, why this method sometimes is referred to as

RFC1867-posting.

This method is mainly designed to better support file uploads. A form that

allows a user to upload a file could be written like this in HTML page:

<form method="POST" enctype='multipart/form-data' action="upload.cgi">
      <input type=file name=upload>
      <input type=submit name=press value="OK">
    </form>

This clearly shows that the Content-Type about to be sent is

multipart/form-data.

To post to a form like this with curl, you enter a command line like:

curl -F upload=@localfilename -F press=OK [URL]
Edited by Rraney
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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