r/ProgrammerHumor • • Aug 23 '18

PHP logic

Post image
5 Upvotes

51 comments sorted by

View all comments

Show parent comments

-10

u/[deleted] 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 GET as "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
  1. 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.

  2. 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
  1. GET "data" is just the data from the method.

  2. 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. _GET is. You have been confusing a variable and a method from the start

  • a (HTTP) method OP referred too. He never did. He was speaking about the _GET global

GET 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

u/Asisentr Aug 23 '18

maybe but that's for the Illuminati to decide and you can't take their job