Sign in to follow this  
Followers 0
Assault

Write info from Webpage to file

2 posts in this topic

#include<Array.au3>
#include <INet.au3>
#include <file.au3>
global $item, $x, $output

call("a")
func a()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/a.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

b()
EndFunc

func b()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/b.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

c()
EndFunc

func c()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/c.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

d()
EndFunc

func d()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/d.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

e()
EndFunc

func e()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/e.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

f()
EndFunc

func f()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/f.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

g()
EndFunc

func g()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/g.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

h()
EndFunc

func h()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/h.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

i()
EndFunc

func i()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/i.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

j()
EndFunc

func j()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/j.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

k()
EndFunc

func k()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/k.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

l()
EndFunc

func l()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/l.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

m()
EndFunc

func m()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/m.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

n()
EndFunc

func n()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/n.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

o()
EndFunc

func o()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/o.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

p()
EndFunc

func p()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/p.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

q()
EndFunc

func q()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/q.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

r()
EndFunc

func r()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/r.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

s()
EndFunc

func s()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/s.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

t()
EndFunc

func t()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/t.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

u()
EndFunc

func u()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/u.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

v()
EndFunc

func v()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/v.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

w()
EndFunc

func w()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/w.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

x()
EndFunc

func x()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/x.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

y()
EndFunc

func y()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/y.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next

z()
EndFunc

func z()
filewrite("a.txt",_INetGetSource('http://www.diablo2guide.com/database/items/z.php'))
_filereadtoarray("a.txt",$item)

For $x = 1 to $item[0]
    If StringInStr ($item[$x], "<body>") Then
        $item[$x] = StringReplace ($item[$x], '">', "")
        $item[$x] = StringReplace ($item[$x], "</a><br /><b>", "")
    EndIf
Next


EndFunc

It doesnt grab anything I think the problem is I'm using StringInStr wrong.

What I want it to do is grab the names of the items from the source.


Share this post


Link to post
Share on other sites



You Mean By This Small Script - -*

I Made It In 5 Minutes

#include <String.au3>
#include <INet.au3>

For $asc = 97 To 122
    FileDelete(Chr($asc) & '.txt')
    $Name = _StringBetween(_INetGetSource('http://www.diablo2guide.com/database/items/' & Chr($asc) & '.php'), '" title="' & Chr($asc), '">')
    $Info = _StringBetween(_INetGetSource('http://www.diablo2guide.com/database/items/' & Chr($asc) & '.php'), '</a><br /><b>Stats:</b> ', '</li><li style="vertical-align: middle; list-style: disc url(')
    For $i = 0 To UBound($Name) - 1
        FileWrite(Chr($asc) & '.txt', 'Name:' & Chr($asc) & $Name[$i] & @CRLF & 'Stats:' & $Info[$i] & @CRLF)
    Next
Next

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