PDA

View Full Version : Interation with Buttons in Neopets/another Links



loucamente
02-02-2012, 09:44 PM
Hi, someone can tell me a way that I can use a button inside in a neopets link through the html page? Some way that I can interacting with the elements of a page?
Example: At my program I acess the Tombola and after I post(click) "play tombola".
I don't worry about the programation language example, I just want a example and the aplication so after I try to work on it.

Thank you! :D

j03
02-03-2012, 02:50 PM
So lost, can you rephrase this at all?

loucamente
02-03-2012, 03:23 PM
So lost, can you rephrase this at all?
ok!
Well, how I make the interaction with the button of tombola in my example program to play?

Soredavide
02-03-2012, 03:23 PM
If you are using VB6 and a wrapper


Dpage = Wrapper.PostWrapper("[Only registered and activated users can see links]", "[Only registered and activated users can see links]")

loucamente
02-03-2012, 04:01 PM
If you are using VB6 and a wrapper


Dpage = Wrapper.PostWrapper("[Only registered and activated users can see links]", "[Only registered and activated users can see links]")


hnm
So all I need to do is use a referrer?

---------- Post added at 03:01 PM ---------- Previous post was at 02:42 PM ----------

I tried go to the referrer url and after go to destination url and don't worked... What i do?

Soredavide
02-03-2012, 06:29 PM
What wrapper are you using, the one I am using needed another comma and quotes to account for the data?

URL As String, Datastring As String, Optional Referer As String

loucamente
02-03-2012, 07:24 PM
What wrapper are you using, the one I am using needed another comma and quotes to account for the data?

URL As String, Datastring As String, Optional Referer As String

I see that my wrapper doesn't this. Do you know the Zer0's wrapper? I'm using that.
I need to know how is the process needed to send the action of a button inside a neopets url without use a url direct code. (Conecting to a url and aft send the button action)

j03
02-03-2012, 07:30 PM
Zer0's Wrapper? Is it in VB or C#.NET? I think that's a C# wrapper... can't remember.

Maybe post pictures of what you are trying to do?

Reemer
02-03-2012, 07:42 PM
I know that Zer0 made a wrapper for Java. Maybe that's what it is.

Soredavide
02-03-2012, 07:45 PM
Yes the only wrapper I know of named zer0's is a java wrapper, maybe you could post the code you are using with the wrapper.

loucamente
02-03-2012, 07:46 PM
Zer0's Wrapper? Is it in VB or C#.NET? I think that's a C# wrapper... can't remember.

Maybe post pictures of what you are trying to do?

Yes, it's a Java class.

I don't changed anything because I was thinking that wouldn't be necessary =\

n00ne
02-04-2012, 12:22 AM
I believe he is asking how you make a command button load the tombola page then play tombola or as he so eloquently put it 'use the button'.

j03
02-04-2012, 12:35 AM
Ah I'm still lost >.< Please post some pictures to help illustrate your question.

loucamente
02-04-2012, 05:53 PM
I believe he is asking how you make a command button load the tombola page then play tombola or as he so eloquently put it 'use the button'.
yes, is it!

---------- Post added at 04:50 PM ---------- Previous post was at 04:33 PM ----------


Ah I'm still lost >.< Please post some pictures to help illustrate your question.
Ok, my copy of Zer0's wrapper:

package fluxoUrl;

import java.io.*;
import java.net.*;
import java.util.*;
import java.util.zip.*;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;

public class Conexao implements Serializable {
static final long serialVersionUID = 1L;

String domain, referer;
Map<String,String> cookies;

static String rpUseragent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8";
static String rpAcceptText = "ttext/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
static String rpAcceptPng = "image/png,image/*;q=0.8,*/*;q=0.5";
static String rpAcceptLanguage = "en-us,en;q=0.5";
static String rpAcceptEncoding = "gzip, deflate";
static String rpAcceptCharset = "ISO-8859-1,utf-8;q=0.7,*;q=0.7";
static String rpKeepAlive = "300";
static String rpConnection = "keep-alive";
static String rpContentType = "application/x-[Only registered and activated users can see links]";

public Conexao(String domain, Map<String,String> cookies, String referer) {
this.domain = domain;
this.cookies = cookies;
this.referer = referer;
}

public Conexao(String domain, Map<String,String> cookies) {
this(domain, cookies, null);
}

public Conexao(String domain, String referer) {
this(domain, new HashMap<String,String>(), referer);
}

public Conexao(String domain) {
this(domain, new HashMap<String,String>(), null);
}

public String get(String url) {
if(url.charAt(0) == '/')
url = domain + url;

try {
[Only registered and activated users can see links] conn = ([Only registered and activated users can see links])(new URL(url.replaceAll(" ", "%20")).openConnection());
setRequestProperties(conn);
conn.setRequestMethod("GET");
referer = url;
return read(conn);
} catch(IOException e1) {
return null;
}
}

public String getButtonAction(String ButtonName, String value, String url) {
try {
[Only registered and activated users can see links] conn = ([Only registered and activated users can see links])(new URL(url.replaceAll(" ", "%20")).openConnection());
setRequestProperties(conn);
conn.setRequestProperty(ButtonName, value);
conn.setRequestMethod("GET");
conn.getResponseCode();
referer = url;
return read(conn);
} catch(IOException e1) {
return null;
}
}

public String post(String url, String[][] data) {
if(url.charAt(0) == '/')
url = domain + url;

try {
[Only registered and activated users can see links] conn = ([Only registered and activated users can see links])(new URL(url.replaceAll(" ", "%20")).openConnection());
setRequestProperties(conn);
conn.setRequestMethod("POST");
conn.setDoOutput(true);

StringBuilder sb = new StringBuilder();

for(int i = 0; i < data[0].length; i++)
sb.append(URLEncoder.encode(data[0][i], "UTF-8")).append('=').append(URLEncoder.encode(data[1][i], "UTF-8")).append('&');

conn.setRequestProperty("Content-Type", rpContentType);
conn.setRequestProperty("Content-Length", Integer.toString(sb.length()-1));

PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(conn.getOutputStream())));
out.write(sb.substring(0, sb.length()-1));
out.close();

referer = url;
return read(conn);
} catch(IOException e1) {
return null;
}
}


public BufferedImage getImage(String url) {
try {
[Only registered and activated users can see links] conn = ([Only registered and activated users can see links])(new URL((url.charAt(0) == '/' ? domain+url : url).replaceAll(" ", "%20")).openConnection());
setRequestProperties(conn);
conn.setRequestMethod("GET");
conn.setRequestProperty("Accept", rpAcceptPng);
return ImageIO.read(conn.getInputStream());
} catch(IOException e1) {
return null;
}
}

public boolean hasCookie(String key) {
return cookies.containsKey(key);
}

public String getCookieString() {
StringBuilder sb = new StringBuilder();

for(String s : cookies.keySet())
sb.append(s).append('=').append(cookies.get(s)).ap pend(';');

return sb.toString();
}

private void setRequestProperties([Only registered and activated users can see links] conn) {
conn.setInstanceFollowRedirects(false);
conn.setRequestProperty("User-Agent", rpUseragent);
conn.setRequestProperty("Accept", rpAcceptText);
conn.setRequestProperty("Accept-Language", rpAcceptLanguage);
conn.setRequestProperty("Accept-Encoding", rpAcceptEncoding);
conn.setRequestProperty("Accept-Charset", rpAcceptCharset);
conn.setRequestProperty("Keep-Alive", rpKeepAlive);
conn.setRequestProperty("Connection", rpConnection);

if(referer != null && referer.length() != 0)
conn.setRequestProperty("Referer", referer);

if(cookies != null && cookies.size() != 0)
conn.setRequestProperty("Cookie", getCookieString());
}

private String read([Only registered and activated users can see links] conn) throws IOException {
BufferedReader in = null;

if(conn.getContentEncoding() == null)
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
else
if(conn.getContentEncoding().equalsIgnoreCase("gzip"))
in = new BufferedReader(new InputStreamReader(new GZIPInputStream(conn.getInputStream())));
else if(conn.getContentEncoding().equalsIgnoreCase("deflate"))
in = new BufferedReader(new InputStreamReader(new InflaterInputStream(conn.getInputStream(), new Inflater(true))));

StringBuilder sb = new StringBuilder();
String s;

while((s = in.readLine()) != null)
sb.append(s).append('\n');

putCookies(conn.getHeaderFields().get("Set-Cookie"));
return sb.toString();
}

private void putCookies(List<String> cookieList) {
if(cookieList == null)
return;

int index;

for(String cookie : cookieList)
cookies.put(cookie.substring(0, index = cookie.indexOf('=')), cookie.substring(index+1, cookie.indexOf(';', index)));
}

}

Yesterday was working at least for keep the connection, but today is useless because neither keeps the login!
O.O
What the hell happens? I don't changed anything important in the code of Zer0's wrapper!

---------- Post added at 04:53 PM ---------- Previous post was at 04:50 PM ----------

Yes, I need of a new wrapper...

n00ne
02-04-2012, 10:58 PM
I'll try explain Joe. His aim is to create a tombola player, he knows how to call the page (would be something along the lines of):


w.GetWrapper("[Only registered and activated users can see links]")

He now want's to play tombola. I would of thought it would be along the line of PostWrapper tombola2.phtml as a referrer from tombola.phtml?(Just realised it's also what soredivide suggested trying), but basically a method to press "Play Tombola". Or if you still cant understand


<form action='tombola2.phtml' method='post'>
<input type='submit' value='Play Tombola!'>

lmao, pictures to illustrate ur question.... it weren't that bad xD.

Soredavide
02-05-2012, 06:36 AM
Try changing wrappers (sock has a java wrapper), seems all I needed was a referrer. Post some of your code, not the wrapper.

loucamente
02-05-2012, 11:49 AM
I don't have a code for it... I just do a example, because I needed understand how the interation can be done. I posted the wrapper used for this, considering the wrapper to after make the method in java, but I think that with this wrapper doesn't has support. I will try to make my own wrapper and if not works, I will use another language programming.

Josh
02-07-2012, 09:03 AM
I don't have a code for it... I just do a example, because I needed understand how the interation can be done. I posted the wrapper used for this, considering the wrapper to after make the method in java, but I think that with this wrapper doesn't has support. I will try to make my own wrapper and if not works, I will use another language programming.

How do you expect to make a wrapper if you arent able to use one that is already made for you? I know the wrapper works, since its the same one Ive used for all my java programs. Don't blame the wrapper for you not knowing how to use it.

Post some code of you attempting to use the wrapper. That is the only way we will be able to help you, unless we wrote the entire program for you.


Just a few hints:

private static Connection w = new Connection( "[Only registered and activated users can see links]" );

^You need something like that first. And you need to actually be logged into neo, which is where you should have learned how to post data with a wrapper.


Learn to create the program in visual basic. Theres no need to use java for this type of program. Its a lot easier to learn the basics of neo programming in a language that isnt as complex. Java is not an easy language.

j03
02-07-2012, 10:15 AM
^Neither is VB6, but the use of a wrapper makes everything easier.

loucamente
02-07-2012, 06:55 PM
How do you expect to make a wrapper if you arent able to use one that is already made for you? I know the wrapper works, since its the same one Ive used for all my java programs. Don't blame the wrapper for you not knowing how to use it.

Post some code of you attempting to use the wrapper. That is the only way we will be able to help you, unless we wrote the entire program for you.


Just a few hints:

private static Connection w = new Connection( "[Only registered and activated users can see links]" );

^You need something like that first. And you need to actually be logged into neo, which is where you should have learned how to post data with a wrapper.


Learn to create the program in visual basic. Theres no need to use java for this type of program. Its a lot easier to learn the basics of neo programming in a language that isnt as complex. Java is not an easy language.

thank you anyway, after I will try VB6. My java program makes log in but I'm having a lot of problems with this question of buttons...

---------- Post added at 05:55 PM ---------- Previous post was at 05:54 PM ----------


^Neither is VB6, but the use of a wrapper makes everything easier.
Okay, then I will try VB6. =]