sending variables to PHP scripts

Pages: 1234... 6
That's like the opposite of technical. Technical is hiring a lawyer ;)
so if i want to post a name value pair to a page i just type
name=name&value=value
if I got the name value pair right, the address right and the error 403 "no protocol" what could have I sent wrong?

I been sending things corectly from the begining but cant seem to send the right things to the right pages
How does that make sense? It's always name=value
That's not how it works. You can't put the name/value pairs in the URL for the POST method, they go in the body of the request. They go in the URL for the GET method. The name/value pairs look like this: name=john&age=25&height=180&weight=65. You are also allowed to use semicolon as a separator instead of ampersand (&) because otherwise GET data in HTML documents would have to use escaped ampersands (&).
Last edited on
LOL
name=password&value=whoopdeedooh
then
No, the & separates name/value pairs, the = separates the name from the value. Instead of name=username&value=chrisname it would be username=chrisname. Don't imagine the & means "and", it's just a separator. Like I said, you can use semicolon as well for GET requests (and probably POST as well):
username=chrisname;password=niceTry.
Last edited on
isnt this code sending things in the body though?

1
2
3
4
5
URL url = new URL(A);
                    URLConnection con = url.openConnection();
                    con.setDoOutput(true);
                    OutputStreamWriter writer = new OutputStreamWriter(con.getOutputStream());
                    writer.write(F);
Yeah, that's using the POST method. The GET method sends the query string (name/value pairs) in the URL, so it's less secure (whenever you see a ? in a URL, that's the start of a GET query string).
ah, so you can solve my problem easily which is i need to post the html equivelent of this :
1
2
3
<form method="post" action="http://www.hackthis.co.uk/levels/i2.php">
<input type="hidden" name="password" value="flubergump">
</form>


I have been posting variations of name=password&value=flubergump with that above code to no avail!

any idea of why? do i need to uf 8 encode it?

Im trying to make a "post stuff tool" B)

EDIT: so i can move onto c++ again, next im going touse sdl for a bunny breeding simulator
Last edited on
No, it would be password=flubergump. The & separates pairs of names and values (so you can send more than one variable at a time); the = separates the name from the value.

What you're doing is equivalent to writing int i = i; 5 = 5; in C++ when you should be writing int i = 5;.
Last edited on
How come I still get a 403 error? am i sending to right place? do i have to acount for its type= "hidden" i cant find documentation on this exact problem.

EDIT: thanks for your help on that one there dude
Last edited on
ah its more complex passing something to a php script than I thought it was, apparently this isn't the correct way to even think about doing it!
You don't use an HTML page to have Java code call a PHP script.
@devonrevenge
You dont need to write any code to complete this task, just inspect the search form
I wanted to make a program that could post things to php scripts, i was going to make a "shit posting" tool XD

but yes i think I miss understood something, so what was my code doing
So im sending html data to a php script where i should be sending PHP data to a php script?

or Im using html to send PHP which isnt real? I wanted to either, simulate a form OR simulate what gets sent to a php script in the correct form
No, you're sending a request to a url on a website that just so happens to be a PHP script.

When you submit a form, your browser takes data out of the form and puts it into the request.

Your program is doing the same thing as the browser - putting data in the request. Except there's no form or HTML involved.
Last edited on
ah cool thanks, so my code isnt working simply because im sending the wrong data in the form of a request to the wrong place which isnt helping anyone
How would you do this? im trying to find what it is that I don't understand?
Last edited on
Pages: 1234... 6