PDA

View Full Version : [VB6] Grabbing Neopet Shop Item obj_id Value



Vinko
04-25-2012, 10:38 PM
Can someone please point out the mistake i am making,
I am trying to make strVal = 7465
i have worked on it different ways for like the past 2 hrs and can't figure it out.
Please someone make me feel dumb and show me thhe error of my ways.



Dim strHTML as String, strVal as String


strHTML = w.Request("GET", "[Only registered and activated users can see links]")
strVal= GetStringBetween(strHTML, "<b>Special</b>", "<input type")
strVal= GetStringBetween(strVal, "value='", "'><input type"


Spoiler taken straight from the source code of the page, when i view it in firefox.

<b>Special</b></td><input type='hidden' name='obj_id_1' value='7465'><input type='hidden' name='oldcost_1' value='99999'></td><td align=center bgcolor='#ffffcc'><input type='text' name='cost_1' size=6 maxlength=5 value='99999'></td><td width=180 bgcolor='#ffffcc'><i>This mystical codestone is used for training pets in the Mystery Island Training School - it is very valuable!</i></td><td width=40 bgcolor='#ffffcc' align=center><select name=back_to_inv[7465]>
<option value=0>0</option>

jojo
04-25-2012, 11:04 PM
This would just be my guess, but possibly make another variable for StrVal
I.E.
Dim StrVal1 as String
strVal= GetStringBetween(strVal1, "value='", "'><input type"
Also maybe you need a referral in strHTML = w.Request("GET", "[Only registered and activated users can see links]" ?

That's just my guess though

j03
04-25-2012, 11:05 PM
^More efficient to just store in strVal first then grab from strVal again and assign final value.

Vinko
04-25-2012, 11:18 PM
This would just be my guess, but possibly make another variable for StrVal
I.E.
Dim StrVal1 as String
strVal= GetStringBetween(strVal1, "value='", "'><input type"
Also maybe you need a referral in strHTML = w.Request("GET", "[Only registered and activated users can see links]" ?

That's just my guess though

I was thinking the same thing but even when i took the last step out strVal returned nothing

strHTML = w.Request("GET", "[Only registered and activated users can see links]")
strVal= GetStringBetween(strHTML, "<b>Special</b>", "<input type")
label1.caption = ( "" & strVal)
list1.additem = strVal

both label1 and list1 come back with nothing.

then when i did

If InStr(strHTML, "strHTML, "Special") Then
label2.caption = "yes"
else
label2.caption = "no"
end if

it tells me no everytime.


its like strHTML is not grabbing the full source code.

Infamous Joe

Joshsadf
04-25-2012, 11:22 PM
Does the wrapper use "" or '' for its HTML? I'd try debug every step to see where it is going wrong to start with.

Vinko
04-25-2012, 11:27 PM
Does the wrapper use "" or '' for its HTML? I'd try debug every step to see where it is going wrong to start with.

not sure josh, it is the ripperwrapper that i got off this site.

EDIT: Oh josh it uses " around the http and anytime there is one in the strand i have to put another one.

really new to all this, basically i want it to price thee items in my shop

using the value in my text box..

it works using this


strItemValue is the string i set up to equal the text in my textbox

strhtml = w.Request("GET", "[Only registered and activated users can see links]")
strhtml = w.Request("POST", "[Only registered and activated users can see links]" & strItemValue & "&back_to_inv%5B7465%5D=0&lim=30&obj_name=", "[Only registered and activated users can see links]")



but that is because in the coding i have the value actually typed in, it is for one of the codestones.
not everytime will the item be this codestone so i am trying to grab the value so i can make it a variable.

Joshsadf
04-26-2012, 12:42 AM
Dim strHTML as String, strVal as String

strHTML = w.Request("GET", "[Only registered and activated users can see links]")
strVal= GetStringBetween(strHTML, "<b>Special</b>", "<input type")
msgbox strVal
strVal= GetStringBetween(strVal, "value='", "'><input type")


See if the msgbox fills with what is meant to be grabbed.

Zachafer
04-26-2012, 12:48 AM
Can someone please point out the mistake i am making,
I am trying to make strVal = 7465
i have worked on it different ways for like the past 2 hrs and can't figure it out.
Please someone make me feel dumb and show me thhe error of my ways.



Dim strHTML as String, strVal as String


strHTML = w.Request("GET", "[Only registered and activated users can see links]")
strVal= GetStringBetween(strHTML, "<b>Special</b>", "<input type")
strVal= GetStringBetween(strVal, "value='", "'><input type"


Spoiler taken straight from the source code of the page, when i view it in firefox.

<b>Special</b></td><input type='hidden' name='obj_id_1' value='7465'><input type='hidden' name='oldcost_1' value='99999'></td><td align=center bgcolor='#ffffcc'><input type='text' name='cost_1' size=6 maxlength=5 value='99999'></td><td width=180 bgcolor='#ffffcc'><i>This mystical codestone is used for training pets in the Mystery Island Training School - it is very valuable!</i></td><td width=40 bgcolor='#ffffcc' align=center><select name=back_to_inv[7465]>
<option value=0>0</option>


I'm disappointed with the responses thus far. Do you guys even put thought into these responses?


strVal = GetStringBetween(strHTML, "<b>Special</b>", "<input type") is the problematic line.

Look at the HTML you posted:

<b>Special</b></td><input type='hidden' name='obj_id_1' value='7465'> that getbetween returns "</td>"

Try this:

strHTML = w.Request("GET", "[Only registered and activated users can see links]")
strVal = GetStringBetween(strHTML, "<b>Special</b>", "<td")
strVal = GetStringBetween(strVal, "value='", "'")

This is a perfect time to use Regex

Vinko
04-26-2012, 04:14 PM
@zach

I tried the above method and it didn't work
so I used the feature you showed me with Ctrl+G
and made it to where strHTML showed in that,
it doesn't appear to be all the source code from the page.

Zachafer
04-26-2012, 07:52 PM
@zach

I tried the above method and it didn't work
so I used the feature you showed me with Ctrl+G
and made it to where strHTML showed in that,
it doesn't appear to be all the source code from the page.

Probably one of two things:
- Immediate Window / CTRL+G (Debug.print) only displays so many characters
- Wrapper doesn't like running in IDE mode

Try:
- Turning off GZIP in the Wrapper (should be a boolean Property in the Properties Window)
- Compiling your program to a .exe and then writing the HTML contents to a file (Open , Input , Close)

Vinko
04-26-2012, 09:03 PM
Probably one of two things:
- Immediate Window / CTRL+G (Debug.print) only displays so many characters
- Wrapper doesn't like running in IDE mode

Try:
- Turning off GZIP in the Wrapper (should be a boolean Property in the Properties Window)
- Compiling your program to a .exe and then writing the HTML contents to a file (Open , Input , Close)


Ran into same issue here


Dim NeoShop As String
Dim NeoShop1 As String

NeoShop = w.Request("GET", "[Only registered and activated users can see links]")
neoshop1 = GetStringBetween(NeoShop, "Size:</b>", "<br><br>")
lblShopSize.Caption = ("" & neoshop1)


Doesn't seem to want to work

Soredavide
04-27-2012, 11:43 AM
The issue seems to have been a gzip problem, the issue was fixed last night.

Zachafer
04-28-2012, 01:15 PM
The issue seems to have been a gzip problem, the issue was fixed last night.



Try:
- Turning off GZIP in the Wrapper (should be a boolean Property in the Properties Window)

What did I tell ya? :D