Kevin S
Kevin S

Reputation: 172

Read URL Encoded parameters PHP

I am trying to send data to my php script, but I have encoded the URL with my Java application:

final URL url = new URL(base + URLEncoder.encode(params, "UTF-8"));

And this makes the following:

http://www.example.com/send.php?username%3DTest%26runtime%3D15

I use $_GET['username'] and $_GET['runtime'] and when I try to echo those, it prints nothing.

What am I doing wrong?

Upvotes: 1

Views: 83

Answers (1)

Ali Akbar Azizi
Ali Akbar Azizi

Reputation: 3496

Your url should have = after username

http://www.example.com/send.php?username=%3DTest%26runtime%3D15

And then you can use $_GET['username']. you have problem with creating url in java, not php.

maybe your java code should be like this

final URL url = new URL(base + "=" + URLEncoder.encode(params, "UTF-8"));

Upvotes: 2

Related Questions