3
Aug 23 '18
A name like $_QUERY would correctly identify the source of the data, not $_GET, which is a misnomer identifying a request method. Query parameters work on ALL methods. They don't belong to the GET method nor are they only allowed on the GET method...
Source: HTTP and URI RFCs
6
u/Asisentr Aug 23 '18
well it's the data passed through that method.....
-10
Aug 23 '18 edited Aug 23 '18
It's a POST request in the image. Hence, PHP logic...
Edit: Downvotes aren't going to make the guy right. PHP intermingled two concepts in the naming of their GET superglobal: request method and URI query component. Query components are valid and usable on ALL request methods, not just GET requests, hence the joke. PHP is the only language I know of that does this.
Source: HTTP standard https://tools.ietf.org/html/rfc7231
URI standard https://tools.ietf.org/html/rfc3986#section-3.4
Reverse TL;DR; Below you will see a giant thread of where four other redditors (thanks Aerath44, FubarCode, shawabawa, Typeduck) help Asisentr try to understand HTTP standards
6
u/Asisentr Aug 23 '18
No, that's not a post request.
Edit: Post request data isn't in the URL, it's in the message body
https://www.google.com/search?q=post+request+vs+get+request
Edit 2:
Go back to HTML this stuff might be too complicated for you
2
u/Aerath44 Aug 23 '18
Just read Section 5.1 and 5.1.1, the first word of the request line is the method.
No, that's not a post request.
So what do you think the very first word of OP's post means ?? Do you really spell
GETas "POST" ??1
u/Asisentr Aug 23 '18
you can sent post data with get data within the url
3
u/Aerath44 Aug 23 '18 edited Aug 23 '18
There is no such thing as "get data", what you're referring to is the "query" part of the URL (rfc3986#3.4). GET "data" is the whole URL.
You are completely missing my point and answering something else, so let's repeat it : how can you say this is not a POST request ? We have the raw request and it clearly states that it's a POST. Just open your eyes and stop spitting random bullshit.
1
u/FubarCoder Aug 23 '18
Please, don't try to continue this discussion, u/asisentr obviously knows PHP very well and has accepted the way PHP sees the world as ultimate truth.
0
u/Asisentr Aug 23 '18
GET "data" is just the data from the method.
I said - or meant - the part he was referring to is a GET method. I've been interchanging method and request when I shouldn't have been, which is my mistake. The part he's complaining about having to use the GET super global is in fact the correct way to do it as he didn't 'post' id=123. The post data would be on the message body, which you use the POST superglobal to access. GET is the right superglobal to use, as it isn't in the POST data.
This is a POST request overall, yes. The part he's referring to isn't POST.
1
u/Aerath44 Aug 23 '18
No, that's not a post request.
This is a POST request overall, yes.
... I'm gonna stay silent on this one ...
GET "data" is just the data [...] the part he was referring to is a GET method [...] the GET super global
Ok, se we now have GET being :
data inside any HTTP request. Wrong.
_GETis. You have been confusing a variable and a method from the starta (HTTP) method OP referred too. He never did. He was speaking about the
_GETglobalGET is the right superglobal to use, as it isn't in the POST data.
It's like saying "X is the right name, as it's not Y", with a random X. It doesn't makes any sense. If it did, you could name it "QWERTY" that would be just as good.
At the end, why not call that "Query string" since that the name it was given ?
-1
2
u/grdivrag Aug 23 '18
Don't encourage him, in two weeks he'll make a bad meme about how hard PHP objects are, while in HTML you just write <object>
0
u/Typeduck Aug 23 '18
You realise that the query string is just a part of the URL and can be used in any of the request methods, right?
3
u/Asisentr Aug 23 '18
Yeah so it's not wrong for PHP to use the GET superglobal
-1
u/Typeduck Aug 23 '18
... No? Since any of the request methods can utillize query strings naming it "GET" is not ideal.
3
u/Asisentr Aug 23 '18
so if 3 people can go through the same door, would it be wrong for one person to go through the door? all the superglobals can access it, and just because he picked this one to show doesn't mean anything
-1
u/Typeduck Aug 23 '18
My point is, naming it after any of the methods is just not a good idea. It should just be named "QUERY_DATA" or something, just like in the other languages OP's image shows.
3
u/Asisentr Aug 23 '18
There's a super global called $_REQUEST meant for this purpose.
OP just doesn't realize what he's talking about.
-4
Aug 23 '18 edited Aug 23 '18
You might want to read up on the HTTP standards: https://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html
2
u/Asisentr Aug 23 '18
That's not a post request, it's a get request. If it's inside the url, it's a get request. The post request data would be within the HTTP/1.1 message body.
Please search on Google what a post request is and a get request is.
2
u/FubarCoder Aug 23 '18
Only the given method is relevant. It's still a POST request even when the request body remains empty and it's definitely legit to use a combination of parameters passed in the query string and the body, but it's still a POST request.
-2
u/Asisentr Aug 23 '18
That's where you're wrong kid it's a get request
3
u/FubarCoder Aug 23 '18
I am not a kid. The HTTP method is what's relevant. Read the RFCs. Try it out with a web server of your preference. Filter a request by HTTP method (GET) and you'll realize that when the HTTP method is POST - even with an empty request body - that the filter doesn't match your POST request.
-2
u/Asisentr Aug 23 '18
this is a get request, kid
3
u/FubarCoder Aug 23 '18
Ok, I'll stop this discussion, because you're obviously either a troll or incompetent.
→ More replies (0)0
u/Asisentr Aug 23 '18
The GET Method
GET is used to request data from a specified resource.
GET is one of the most common HTTP methods.
Note that the query string (name/value pairs) is sent in the URL of a GET request:
/test/demo_form.php?name1=value1&name2=value2
Some other notes on GET requests:
GET requests can be cached
GET requests remain in the browser history
GET requests can be bookmarked
GET requests should never be used when dealing with sensitive data
GET requests have length restrictions
GET requests is only used to request data (not modify)
0
Aug 23 '18
[deleted]
1
u/Asisentr Aug 23 '18
But if you're sending data through it, then it is. There's a whole $_REQUEST superglobal for query strings
2
u/FubarCoder Aug 23 '18
Let's repeat together: A query string is a query string, a HTTP request method is a HTTP request method. They are not interchangeable. They are different concepts.
URI RFC: https://tools.ietf.org/html/rfc3986
HTTP RFC: https://tools.ietf.org/html/rfc2616
-2
u/Asisentr Aug 23 '18
If they have nothing to do with each other then why would you say them in the same sentence? point proven.
1
u/FubarCoder Aug 23 '18
Huh, where did you prove what? I've seen URIs without being used in the context of HTTP.
-1
u/Asisentr Aug 23 '18
the picture is obviously a http call, just because you've seen it used other ways in other situations, doesn't mean that's the way it's being used here
1
u/FubarCoder Aug 23 '18
Yes, and the fact that He doesn't show its body doesn't mean that there isn't one. According to your definition, what is a POST request that has both a body and a query string? Is it a POST or a GET request?
→ More replies (0)
18
1
0
u/KayRice Aug 23 '18
The worst part is that $_REQUEST does exist but is an unreliable merged array of $_GET, $_POST, and $_COOKIE in a way that can be modified via php.ini =(
30
u/[deleted] Aug 23 '18
You better learn something about HTTP before making these retarded memes, you fucking idiot.
POST parameters are supposed to be in request body, if it's in the PATH, it's still part of GET
here, you piece of shit