get

Why is the GET method faster than POST in HTTP?

ⅰ亾dé卋堺 提交于 2019-12-17 07:17:13
问题 I am new to web programming and just curious to know about the GET and POST methods of sending data from one page to another. It is said that the GET method is faster than POST but I don't know why. One reason I could find is that GET can take only 255 characters? Is there any other reason? Please someone explain to me. 回答1: It's not much about speed. There are plenty of cases where POST is more applicable. For example, search engines will index GET URLs and browsers can bookmark them and

Sending POST data with GET request valid?

我的未来我决定 提交于 2019-12-17 06:52:55
问题 Using Curl for example, I can "post" data in a GET request. Is this a valid thing to do? With that I mean: Is it not forbidden by any RFC specification? Does someone out there use it with good reason? Thanks for any help. 回答1: See RFC2616 - Hypertext Transfer Protocol -- HTTP/1.1, section 4.3 "Message Body": A message-body MUST NOT be included in a request if the specification of the request method (section 5.1.1) does not allow sending an entity-body in requests. In section 9.3 "GET"

Sending POST data with GET request valid?

◇◆丶佛笑我妖孽 提交于 2019-12-17 06:52:41
问题 Using Curl for example, I can "post" data in a GET request. Is this a valid thing to do? With that I mean: Is it not forbidden by any RFC specification? Does someone out there use it with good reason? Thanks for any help. 回答1: See RFC2616 - Hypertext Transfer Protocol -- HTTP/1.1, section 4.3 "Message Body": A message-body MUST NOT be included in a request if the specification of the request method (section 5.1.1) does not allow sending an entity-body in requests. In section 9.3 "GET"

How to pass an array via $_GET in php?

穿精又带淫゛_ 提交于 2019-12-17 06:35:17
问题 How can I pass one or more variables of type array to another page via $_GET? I always passed variable values in the form ?a=1&b=2&c=3 What about passing a=[1,2,3] ? Do I need to write a for loop and append all the values? Thanks 回答1: You can use the [] syntax to pass arrays through _GET: ?a[]=1&a[]=2&a[]=3 PHP understands this syntax, so $_GET['a'] will be equal to array(1, 2, 3) . You can also specify keys: ?a[42]=1&a[foo]=2&a[bar]=3 Multidimentional arrays work too: ?a[42][b][c]=1&a[foo]=2

Sanitizing user's data in GET by PHP

一曲冷凌霜 提交于 2019-12-17 06:23:48
问题 How do you sanitize data in $_GET -variables by PHP? I sanitize only one variable in GET by strip_tags . I am not sure whether I should sanitize everything or not, because last time in putting data to Postgres, the problem was most easily solved by the use of pg_prepare . 回答1: How do you sanitize data in $_GET -variables by PHP? You do not sanitize data in $_GET. This is a common approach in PHP scripts, but it's completely wrong*. All your variables should stay in plain text form until the

How to build query string with Javascript

限于喜欢 提交于 2019-12-17 03:24:42
问题 Just wondering if there is anything built-in to Javascript that can take a Form and return the query parameters, eg: "var1=value&var2=value2&arr[]=foo&arr[]=bar..." I've been wondering this for years. 回答1: I tried to search for an answer to this question some while ago, but I ended up writing my own function that extracts the values from the form .. it's not perfect but it fits my needs. function form_params( form ) { var params = new Array() var length = form.elements.length for( var i = 0;

How to build query string with Javascript

一曲冷凌霜 提交于 2019-12-17 03:24:15
问题 Just wondering if there is anything built-in to Javascript that can take a Form and return the query parameters, eg: "var1=value&var2=value2&arr[]=foo&arr[]=bar..." I've been wondering this for years. 回答1: I tried to search for an answer to this question some while ago, but I ended up writing my own function that extracts the values from the form .. it's not perfect but it fits my needs. function form_params( form ) { var params = new Array() var length = form.elements.length for( var i = 0;

Swift GET request with parameters

僤鯓⒐⒋嵵緔 提交于 2019-12-17 02:59:19
问题 I'm very new to swift, so I will probably have a lot of faults in my code but what I'm trying to achieve is send a GET request to a localhost server with paramters. More so I'm trying to achieve it given my function take two parameters baseURL:string,params:NSDictionary . I am not sure how to combine those two into the actual URLRequest ? Here is what I have tried so far func sendRequest(url:String,params:NSDictionary){ let urls: NSURL! = NSURL(string:url) var request = NSMutableURLRequest

Using the GET parameter of a URL in JavaScript [duplicate]

你说的曾经没有我的故事 提交于 2019-12-16 22:47:52
问题 This question already has answers here : How to retrieve GET parameters from javascript? [duplicate] (17 answers) Closed 5 years ago . If I am on a page such as http://somesite.com/somepage.php?param1=asdf In the JavaScript of that page, I would like to set a variable to the value of the parameter in the GET part of the URL. So in JavaScript: <script> param1var = ... // ... would be replaced with the code to get asdf from URI </script> What would "..." be? 回答1: Here's some sample code for

Are HTTPS headers encrypted?

好久不见. 提交于 2019-12-16 22:21:14
问题 When sending data over HTTPS, I know the content is encrypted, however I hear mixed answers about whether the headers are encrypted, or how much of the header is encrypted. How much of HTTPS headers are encrypted? Including GET/POST request URLs, Cookies, etc. 回答1: The whole lot is encrypted † - all the headers. That's why SSL on vhosts doesn't work too well - you need a dedicated IP address because the Host header is encrypted. † The Server Name Identification (SNI) standard means that the