Why you should use POST instead of GET

in php •  7 years ago  (edited)

GET or POST, two Guys asked me that in the last month so I want to clearify that.

You know that?:
https://www.privacy.safe/donation.php?fname=John&lname=Doe&IBAN=GB19123412341234123412

I often see that the GET-option is used in web forms and sometimes I have to enter privacy relevant informations.
But the problem is that GET-arguments will be shown in the browser's history and address field. Moreover addons like "Ghostery" (german), to call one of them, spy on you. Ghostery had advertising companies as business partners and sold the full URL of accessed pages to them. Ghostery's statement at this time was that they will mask any personal information before transmitting it to their partners. But then the german public TV-broadcaster "NDR" disclosured that they got a demo data record from one of Ghostery's advertising partners that contained personal informations. The data record was a list of accessed websites that where caught by the Ghostery addon installed on innocent's PCs.

Some time ago a few genious developers coded a webshop and the price was in the GET-argument. I think you can conclude the rest...

So you should use POST- instead of GET-options if you don't have a reason to do it on the other way.
Cases where you can use GET-options are:

  • Commands like https://my-raspberry.pi/smarthome?device=light_bedroom&power_percent=40&col=FF0000 to set as bookmark if your girlfriend comes back home
  • URLs you want to be shared with arguments
  • For a search field (that it can be changed in the URL)
  • For testing :)
  • Something that I forgot here because i think to complicated...

Can you add anything that I didn't catch? I'm waiting for your feedback.

Btw: If you search something to hack: Juice-Shop

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Congratulations @technixx! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You made your First Comment

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

Upvote this notification to help all Steemit users. Learn why here!

The question is: what do you want to do.

Sending information: POST
Recieving information: GET

A contact-form sends informations to the server, so you have to use POST.
With a search-form you provide information, so you fhave to use GET.

  ·  7 years ago (edited)

Okay that's another point of view. In both cases you are sending informations but the result of the search form is just a filter of already available information while the contact form feeds the "process"

I actually don't know, what commands like the R-PI example (I have it at home) are. Sending or receiving O_o?

Good question.
If you want to create a new device, you would use POST.
If you want to know the state, you would use GET.
Within a RESTful service I would use PUT or PATCH for this action, because you want to modify something.
The browser doesn't know those commands, so I think you can use both.

Oh, I guess you misunderstood me. I meant changing the status of home devices with the PI.
For creating I also would prefer POST.
The GET method to "change the status" of my home devices (light on/off or open/close shutters) has proved its worth because i can bookmark it and i can call it via VBscript just by request the URL. Maybe I am too lazy.

Sure, i understood.
I said, the right command would be PUT or PATCH, because you want to modify the state. But you can only use GET or POST with the browser.
So both (GET and POST) would be ok...

Congratulations @technixx! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

Are you a DrugWars early adopter? Benvenuto in famiglia!
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Congratulations @technixx! You received a personal award!

Happy Steem Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

Downvote challenge - Add up to 3 funny badges to your board
Vote for @Steemitboard as a witness to get one more award and increased upvotes!