Sign in to follow this  
Followers 0
odd1out

How do I write a file to the Internet

12 posts in this topic

I have a file that I want to share with another user. Both of us need to be able to read and write the online file. We are able to read the file using "InetGet" but there is no such thing as "InetPut" to use. Is there some simple way to write (actually replace) a file on the net. Below is what I use to read the internet file:

$size = InetGetSize( _

"http://www.ofile.com/xxx/textfile.txt")

If $size <> 0 Then

$InternetGetSuccess = InetGet ( _

"http://www.ofile.com/xxx/textfile.txt", _

"textfile.txt", 1 )

EndIf

; ON-LINE file opened for reading OK

$input_file = FileOpen("textfile.txt", 0) ;0 = Read mode

; My ATTEMPT to copy file to the net

FileCopy ( "textfile.txt", "http://www.ofile.com/xxx/textfile.txt", 1 )

I'm kinda new at this, any suggestion would be helpful. Thanks, John

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

you must use a php page on the web site. you can't use just autoit

Edited by FromItalyXD

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

For example, for upload your IP, need only:

#include <Inet.au3>
_INetGetSource("http://www.yoursite.com/ip.php?ip=" & @IPAddress1)

$ip = _INetGetSource("http://www.yoursite.com/file.txt")
if Ping($ip) <> 0 Then MsgBox(0, "Uploaded IP", $ip)

and php:

<?
$file = "file.txt";
unlink($file);
$Handle = fopen($file, 'w+');
$ip = $_GET['ip'];
fwrite($Handle, $ip);
fclose($Handle);
?>[/PHP]

Good luck!:D

Edited by Godless

_____________________________________________________________________________

Share this post


Link to post
Share on other sites

I have a file that I want to share with another user. Both of us need to be able to read and write the online file. We are able to read the file using "InetGet" but there is no such thing as "InetPut" to use. Is there some simple way to write (actually replace) a file on the net. Below is what I use to read the internet file:

$size = InetGetSize( _

"http://www.ofile.com/xxx/textfile.txt")

If $size <> 0 Then

$InternetGetSuccess = InetGet ( _

"http://www.ofile.com/xxx/textfile.txt", _

"textfile.txt", 1 )

EndIf

; ON-LINE file opened for reading OK

$input_file = FileOpen("textfile.txt", 0) ;0 = Read mode

; My ATTEMPT to copy file to the net

FileCopy ( "textfile.txt", "http://www.ofile.com/xxx/textfile.txt", 1 )

I'm kinda new at this, any suggestion would be helpful. Thanks, John

You can use the WEB FOL -DIR feature on that site to create a folder on your PC which you can simply copy files to and that will automatically transfer them to your site.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Like I said, I'm new at this. Thanks for your help. The script, when run, will invisibly open the text file from the web. And this works just fine. When we "Save & Exit" the script should invisibly write/replace the text file. I do not understand how I can incorporate "php" into my script. How are "unlink" "fwrite" and "fclose" added to the script, or called from the script? Finally what is "WEB FOL -DIR" and how is it used within a script. I'm sorry but I just do not see how any of the information can be incorporated into my script to do the things I want.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

If you have FTP access to server you could use something like this.

http://www.textheavy.com/tutorials/batchfile.html

Create your batch file / txt file with ftp details, have your autoit script download the file, then ammend it. When done have your script run the batch file to upload to the server again.

I guess this is how i would start of then try and develop on that.

or...

$cmd = "cmd.exe"
$winTitle = @SystemDir & "\" & $cmd
Run($cmd, @HomeDrive & "\")

WinWait($winTitle)
$winHandle = WinGetHandle($winTitle)

ControlSend($winHandle, "", "", "ftp ftp.microsoft.com {enter}")
sleep(3000)

ControlSend($winHandle, "", "", "username {enter}")
sleep(2000)
ControlSend($winHandle, "", "", "password {enter}")

You could expand on that with some ifs and buts - i guess its somewhere to start atleast.

S

Edited by Steveiwonder

They call me MrRegExpMan

Share this post


Link to post
Share on other sites

Finally what is "WEB FOL -DIR" and how is it used within a script. I'm sorry but I just do not see how any of the information can be incorporated into my script to do the things I want.

Go to www.o-file.com and log in. Choose UpLoad and you will see a screen a part of which looks like this

post-3602-12652273808609_thumb.png

Click the link (Web FOL -DIR) and you will see instructions on how to create a network folder. Once created you will have a folder in Explorer which you can use like any other folder. So if you want to write a file to your site, or "to the internet" as you said then all you have to do is

FileCopy($somefilefullpath, $MynewNetworkFolder & "/Word")

for example. It is about as simple as you could want I should think.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

you must use a php page on the web site. you can't use just autoit

No he doesn't. It can be any active server script like PHP or ASP, or none at all. Other methods have already been suggested.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

No he doesn't. It can be any active server script like PHP or ASP, or none at all. Other methods have already been suggested.

But few of the people replying seem to have looked at the site the OP referred to, and there are no options with the free version to write scripts in any language as far as I can see. So I think the option I described in post #7 is the easiest way to start with. Presumably some HTTP commands could be used to send files to the server the way a network folder does.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

For a non-AutoIt solution:

You could use DropBox and have both of you use the same account. So when you edit the file you put it in "Your DropBox" and then it's in theirs.


For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Share this post


Link to post
Share on other sites

Or maybe, depending on the file type, you could use Google Docs.


The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites

Or Google Wave


For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Share this post


Link to post
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
Sign in to follow this  
Followers 0