Sign in to follow this  
Followers 0
Joshy

I need a Get function that reads a file from an HTTP

11 posts in this topic

#1 ·  Posted (edited)

Look down to my last post please

Edited by Joshy

Share this post


Link to post
Share on other sites



_IEReadText() and StringSplit() to separate the usernames from the passwords. Just create a hidden IE window, navigate to that page, read the text,then compare it.

Share this post


Link to post
Share on other sites

_IEReadText() and StringSplit() to separate the usernames from the passwords. Just create a hidden IE window, navigate to that page, read the text,then compare it.

well currently the way my program is written is it reads the text document and assigns them to arrays and compares the arrays to the user's input.

Share this post


Link to post
Share on other sites

I am just attempting to find a way to get that file to read because currently the file path is just '/list.txt' and i want it to be like 'http://omgwtfbbq.com/list.txt'

Share this post


Link to post
Share on other sites

1) There is an edit button, please stop double posting. It's considered rude on forums.

2) Did you try my suggestion? Create an invisible IE window, navigate to your file (you said you had it hosted), get the body text, then close the window. You have the text you want then you can still assign it to arrays, StringSplit() returns an array.

Returns an array, the first element ($array[0]) contains the number of strings returned, the remaining elements ($array[1], $array[2], etc.) contain the delimited strings.

If no delimiters were found @error is set to 1, the count is 1 ($array[0]) and the full string is returned ($array[1]).

Share this post


Link to post
Share on other sites

1) There is an edit button, please stop double posting. It's considered rude on forums.

2) Did you try my suggestion? Create an invisible IE window, navigate to your file (you said you had it hosted), get the body text, then close the window. You have the text you want then you can still assign it to arrays, StringSplit() returns an array.

#include <IE.au3>
#include <GUIConstants.au3>
#include <String.au3>
;
$oIE = _IECreate("ulr", 0, 0, 0)
$text = _IEBodyReadText($oIE)


MsgBox(0, "", $text)
;

for some reason I get a blank

Share this post


Link to post
Share on other sites

Duh, you told it to go to the site "ulr", which I'm assuming is supposed to be "url". Either way it's not a valid site address. It must be valid and since you have your file hosted simply put that in for the navigation and use _IECreate("http://someurl.com",1,0,1,0) instead.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Okay, so now I got a new problem because i changed the way i wanna do the program to make it simpler.

so I parsed 3 strings together

username, the seperator and password:

example:

username-password

now my $text = _IEBodyReadText($oIE)

and I want to string split or getline each line seperately because the text it reads is like the following:

Example:

omg-wtf

username-password

help-me

iam-noob

uh-oh

and basically what I want to do is get each line and assign it to an array and have the parsed string be compared to the line taken from the bodytext.

I know in C++ I could easily do this:

int i = 0;
string parse = omg-wtf;
vector<string> line;
bool statement = false;

While(line[i] = text.getline)
{
i++;
}

for(j = 0; j < i; j++)
{
  if(line[j] == parse;
   {
     statement = true;
     j = i;
   }
  else
   {
     statement = false;
   }
}

if(statement)
{
~~~~Run~~~
}
else
{
exit(0);
}

so is there a way i can basically convert that code into autoit? so far I have this much converted:

$i = 0
$parse = omg-wtf
$line
$statement
$oIE = _IECreate("http://blahblah.com/list.txt", 0, 0)
$text = _IEBodyReadText($oIE)

While($line[i] = text.getline)     ;;;;;;;;;;; this is where I am having my trouble how would I do my getline for my $text
{
$i + 1
}

for $j = 0 To $i

  if $line[j] = $parse Then
     statement = true;
     $j = $i
  else
     $statement = false;

Next

if $statement = true
~~~~Run~~~
else
$return 0
Edited by Joshy

Share this post


Link to post
Share on other sites

could use _FileReadToArray

Share this post


Link to post
Share on other sites

I'm also interested in it. some guys have the better way except _File?

Share this post


Link to post
Share on other sites

Well, you could do it this way:

#include <INet.au3>

$Found = False

$find = "  The quick brown fox jumps over the lazy dog"

$URL = "http://www.cl.cam.ac.uk/~mgk25/ucs/examples/quickbrown.txt"
$Source = _INetGetSource($URL)


;~ $lines = StringSplit(StringStripCR($Source),@LF)
;~ For $i = 1 To UBound($lines)-1
;~  If $lines[$i] = $find Then
;~      $Found = True
;~      ExitLoop
;~  EndIf
;~ Next

If StringInStr(@LF&StringStripCR($Source)&@LF,@LF&$find&@LF) Then $Found=True

If $Found Then
    MsgBox(0, '', "found")
Else
    MsgBox(0, '', "NOT  found")
EndIf

but it's not very save to use this as Login func. If someone gets to know the address, he has all the usernames and passwords ...


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

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