sending variables to PHP scripts

Pages: 123456
Have you tried this?
http://stackoverflow.com/a/4206094/1959975
I'm pretty sure it's the same think rapidcoder linked to, but your code doesn't match.
Last edited on


My code works, it is that, but posting doesnt work! thats what I dont understand

the problems somewhere else


my newest code is the best working version of all of them, just im sending something that doesnt work.

(I have tried each combination of all the answers on the net im just doing something else wrong)
Can you show the code from where you define the post variables to where you use that definition? (Even if it's all one line).

Also, explain how you know it does not work.
Last edited on
Well I get a 403 error when I get the reply, just touching the code back up after playing with it so much:
Heres the working/not working mystery code, I suspect I am just sending the wrong thing, but I tried sending every kind of way of posting variables to a page, I dont know how close I got at all.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 A = URLField.getText();
                B = textarea.getText();
                F = oneliner.getText();
                C = param2.getText();

              

                    try {

                        URL url = new URL(A);
                        URLConnection con = url.openConnection();
                        con.setDoOutput(true);

                        OutputStreamWriter writer = new OutputStreamWriter(con.getOutputStream());
                        F = URLEncoder.encode(F, "UTF-8");
                        writer.write(F);
                        System.out.println(F);
                        String line;

                        DataInputStream in = new DataInputStream (con.getInputStream ());

                        while ((line = in.readLine()) != null) {
                            G=G + line;
                        }
                      

                    
                    textarea.setText(G);

                     writer.close();
                    in.close();

                } 


I will proly have to save the cookies afterwards to win the hack this challenge, but I know that a 403 error is a sure sign it did not work, I have a practice code too, sending variables to that does get me a reply in form format, but it doesnt change the variable, or at least its not visable
Last edited on
System.out.println(F);

What does this display? I have a feeling that this is your problem - you should only url encode the "name" and the "value", the & and = should not be encoded.
wait what should I want F to say? (if name=password&value=flubergump)


I can turn utf8 on or off, im pretty sure I have tried most combinations, but then what you just said is news to me.

EDIT: theres a space and so it adds a + sign :/
1
2
3
4
5
password+flubergump
password+%3D+flubergump
password%3Dflubergump
password+flubergump
password%3Dflubergump
Last edited on
bucking fump :D
devonrevenge wrote:
wait what should I want F to say? (if name=password&value=flubergump)


You have been told repeatedly that this is wrong - we're tired of correcting yo on this.


IT IS NOT
name=password&value=flubergump


IT SHOULD BE
password=flubergump
Last edited on
OH, I TRIED THAT, NO DICE!

output: password=flubergump
Last edited on
Oh wait I get it :D encode the variaballs not the = and &

sry ritalin is wearing off :P
still no dice though :(
Can you paste the PHP script here? Just the parts that get the $_POST variables.
Okay, this is my practice script, the one on "hackthis.co.uk" is hard to find

1
2
3
4
5
<html>
<body>
YOU ARE THAT <?php echo $_POST ["myname"];?> CHARACTER AINT YOU!
<body>
</html>


Its also on http://mejeef.tk/myscript.php, which is my practice website for messing about on, one day I will make a website and challenge you all to deface it!

hrmm, and there will be prizes :D
Instead of "password=flubergump", try "myname=DOCTOR WHO" (after encoding it would be myname=DOCTOR%20WHO)
Last edited on
I guess your approach is wrong. Your problem is not Java. Your problem is basic understanding how Internet works. Go and figure out first how to do that with pure telnet, and before you have a success there, don't ever touch any coding.
I didn't even know that telnet was a thing so I guess it will be a while till im coding again, but KK if you believe it would be helpful why wouldn't I take your advice? :P
Last edited on
@rapidcoder, by 'that' you mean sending variables to php scripts from telnet?

I mangaed to telnet in but I had to go through port 25 cos 23 was not allowed, wonder what the hell I do from here, fun tho'
Last edited on
HTTP operates on port 80
Script Coder wrote:
If everyone wants to get really technical it is not allowed:
http://www.cplusplus.com/forum/lounge/6/#msg6
admin wrote:
In this forum, users can to talk about topics other than programming

Well even that is showing people's interpretation and it can be taken either way. If you look for synonyms for the words barring (to exclude) you find other than and if you look for the synonym for besides (in addition to) you again see other than. So it depends on how the person interprets admin's line as it could mean either (leaving in unneeded 'to'):

In this forum, users can to talk about topics barring programming.
In this forum, users can to talk about topics excluding programming.

or

In this forum, users can to talk about topics besides programming.
In this forum, users can to talk about topics in addition to programming.

It is all in the interpretation.
Pages: 123456