PHP Code:
function PriceInv()
{
$Source = $this->HTTPWrapper->HTTPRequest("GET", "http://www.gaiaonline.com/profile/inventory.php?type=all",
array("Header" => "http://www.gaiaonline.com/profile/inventory.php"));
$Gold = $this->HTTPWrapper->GetStringBetween($Source,"Gold: </span>", " ");
$Gold = str_replace(",",NULL,$Gold);
$Pattern = '/<img style="cursor: hand;" title="(.*?)" hidden_src="/';
preg_match_all($Pattern,$Source,$Items);
$post = 'environment=0&txt='.urlencode('xtitle="<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Trans');
foreach($Items[1] as $val)
{
$post .= urlencode('xtitle="'.$val.'" hidden_src="http://');
}
$post .= urlencode("Gold: ".$Gold."\t\t\t ");
$URL = "http://www.tektek.org/gaia/worth.php";
$Header = array("Referer" => "http://www.tektek.org/gaia/worth.php");
$this->HTML = $this->HTTPWrapper->HTTPRequest("POST", $URL, $post, $Header);
$this->SortTekTek();
}
Results 1 to 4 of 4
Thread: Ooh, ah!
- 02 May. 2010 02:47pm #1
Ooh, ah!
- 02 May. 2010 03:39pm #2
Thanks alex
Im going trk on porting this to Vb.net
Maybe it will workShh, I'm watching My little pony.
- 16 May. 2010 09:01pm #3
Translated into python. Tested it and noticed that the Gold is now formatted different on Gaia, also the item pattern has a few slashes out of place. My version, pretty much the same as Alex's:
Also, anyone knows if there still are multiple pages in inventories?
Code:#!/usr/bin/env python #TekTek Class #Author: Riddle #E-mail: NONE #Find out how much your account is worth. ##TEMP############ import Gaiaonline# ################## import General import HTTP import urllib.parse class TekTek: def __init__(self, Gaia): """TekTek Class: Make_Profile(): Makes a text file with important information Price_Inv(): Returns the price of the inventory """ self.g = General.General() self.HTTP = Gaia.Get_HTTP() self.User = Gaia.Get_Username() self.Pass = Gaia.Get_Password() self.Email = None self.U_ID = None #Gold formatting on HTML pages of Gaia has changed self.Gold_Start = "<span id=\"gold_amt\">" self.Gold_End = "</span>" #Item Pattern for inventory page self.Item_Patt = "<img style=\"cursor: hand;\" title=\"(.*?)\" hidden_src=" def Price_Inv(self): HTML = self.HTTP.GET("http://www.gaiaonline.com/profile/inventory.php?type=all") Gold = (self.g.GetBetween(HTML,self.Gold_Start,self.Gold_End)).replace(",","") items = self.Parse_Inv(HTML) post = "environment=0&txt=" post += urllib.parse.quote("xtitle=\"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Trans") for item in items: post += urllib.parse.quote("xtitle=\"" + item + "\" hidden_src=\"http://") post += urllib.parse.quote("Gold: " + Gold + "\t\t\t ") URL = "http://www.tektek.org/gaia/worth.php" self.HTTP.Set_Referer("http://www.tektek.org/gaia/worth.php") HTML = self.HTTP.POST(URL,post) Make_Profile(HTML) def Parse_Inv(self,HTML): """Returns a list of items in inventory page""" r = self.g.Find_All(self.Item_Patt,HTML) return r def Make_Profile(self,HTML): """ Save all important data to a text file. - User - User ID - Pass - Email - Worth - List of items with their worth """ #Finish it later... pass
- 16 May. 2010 11:40pm #4
This is to loop through a listbox in UP format
Saves the Page to file. Find the function on your own
PHP Code:dim intAcc As Integer
Dim StrHTML As String
Dim StrFrob As String
Dim StrToken As String
Dim StrSplit As String
Dim StrUserPass() As String
Dim IntAcct As Integer
For IntAcct = 0 To lstACC.Items.Count - 1
StrSplit = (lstACC.Items.Item(IntAcct))
StrUserPass = Split(StrSplit, ":")
StrHTML = wrapper.GetWrapper("http://www.gaiaonline.com/auth/login")
StrToken = GetStringBetween(StrHTML, "name=""token"" value=""", """")
StrFrob = GetStringBetween(StrHTML, "name=""frob"" value=""", """")
StrHTML = wrapper.PostWrapper("http://www.gaiaonline.com/auth/login", "token=" & StrToken & "&sid=&frob=" & StrFrob & "&toolbar_id=&redirect=http%3A%2F%2Fwww.gaiaonline.com%2F&username=" & StrUserPass(0) & "&password=" & StrUserPass(1) & "&chap=")
If (InStr(1, StrHTML, "?login_success=1") <> 0) Then
Dim strgold As String
TextBox1.Text = ""
TextBox2.Text = ""
StrHTML = wrapper.GetWrapper("http://www.gaiaonline.com/inventory")
strSauce = GetStringBetween(StrHTML, "<!DOCTYPE html", "<!-- buffered output -->")
TextBox1.Text = strSauce
Encode(TextBox1, TextBox2)
strSauce = TextBox2.Text
StrHTML = wrapper.GetWrapper("http://www.tektek.org/gaia/worth.php")
StrHTML = wrapper.PostWrapper("http://www.tektek.org/gaia/worth.php", "environment=0&txt=" & strSauce)
strHtSc = GetStringBetween(StrHTML, "<!DOCTYPE", "</html>")
strHtSc = "<!DOCTYPE" & strHtSc & "</html>"
SaveTextToFile(strHtSc, Application.StartupPath & " " & StrUserPass(0) & ".html")
wrapper.ClearCookies()
StrHTML = wrapper.GetWrapper("http://gaiaonline.com/wap/login")
StrHTML = wrapper.PostWrapper("http://gaiaonline.com/wap/login", "username=" & StrUserPass(0) & "&password=" & StrUserPass(1))
If (InStr(1, StrHTML, "http://s2.cdn.gaiaonline.com/images/goldnotify/gold_static.gif") <> 0) Then
strgold = GetStringBetween(StrHTML, "gold_static.gif"" /> ", "</div>")
ListBox1.Items.Add(StrUserPass(0) & ":" & StrUserPass(1) & ":" & strgold)
wrapper.ClearCookies()
End If
ListBox1.Items.Add("Tektek file for " & StrUserPass(0) & " Has been saved")
Else
wrapper.ClearCookies()
End If
Next
Shh, I'm watching My little pony.