Questions tagged [query-string]

The part of a URL after the ? (question mark), containing parameter=value pairs separated by & (ampersand). In a request made to a web application at a particular URL, the parameter+value data in the query string is parsed/consumed by the web application on the backend that receives the request.

See also: https://en.wikipedia.org/wiki/Query_string

5108 questions
150
votes
5 answers

What is the difference between URL parameters and query strings?

I don't see much of a difference between the parameters and the query strings, in the URL. So what is the difference and when should one be used over the other?
koninos
  • 4,969
  • 5
  • 28
  • 47
141
votes
20 answers

How do I use regex in a SQLite query?

I'd like to use a regular expression in sqlite, but I don't know how. My table has got a column with strings like this: "3,12,13,14,19,28,32" Now if I type "where x LIKE '3'" I also get the rows which contain values like 13 or 32, but I'd like to…
cody
  • 6,389
  • 15
  • 52
  • 77
135
votes
11 answers

Fastest way to implode an associative array with keys

I'm looking for a fast way to turn an associative array in to a string. Typical structure would be like a URL query string but with customizable separators so I can use '&' for xhtml links or '&' otherwise. My first inclination is to use foreach…
matpie
  • 17,033
  • 9
  • 61
  • 82
118
votes
7 answers

What's valid and what's not in a URI query?

Background (question further down) I've been Googling this back and forth reading RFCs and SO questions trying to crack this, but I still don't got jack. So I guess we just vote for the "best" answer and that's it, or? Basically it boils down to…
John Leidegren
  • 59,920
  • 20
  • 131
  • 152
117
votes
7 answers

How to pass multiple parameters in a querystring

I have three values which I have to pass as parameters for e.g., strID, strName and strDate. I want to redirect these three parameters to another page in Response.Redirect().Can anybody provide me with the correct querystring?
user42348
  • 4,181
  • 28
  • 69
  • 98
114
votes
2 answers

Is it valid to have more than one question mark in a URL?

I came across the following URL today: http://www.sfgate.com/cgi-bin/blogs/inmarin/detail??blogid=122&entry_id=64497 Notice the doubled question mark at the beginning of the query string: ??blogid=122&entry_id=64497 My browser didn't seem to have…
Bungle
  • 19,392
  • 24
  • 79
  • 106
111
votes
16 answers

PHP file_get_contents() returns "failed to open stream: HTTP request failed!"

I am having problems calling a url from PHP code. I need to call a service using a query string from my PHP code. If I type the url into a browser, it works ok, but if I use file-get-contents() to make the call, I get: Warning:…
undefined
  • 5,190
  • 11
  • 56
  • 90
108
votes
2 answers

How do I parse a URL query parameters, in Javascript?

Possible Duplicate: Use the get paramater of the url in javascript How can I get query string values in JavaScript? In Javascript, how can I get the parameters of a URL string (not the current URL)? like: www.domain.com/?v=123&p=hello Can I get…
user847495
  • 9,831
  • 17
  • 45
  • 48
106
votes
15 answers

JavaScript query string

Is there any JavaScript library that makes a dictionary out of the query string, ASP.NET style? Something which can be used like: var query = window.location.querystring["query"]? Is "query string" called something else outside the .NET realm? Why…
core
  • 32,451
  • 45
  • 138
  • 193
106
votes
5 answers

OK to skip slash before query string?

Is it safe to always skip the trailing slash when appending a query string? That is, can I use http://example.com?querystring instead of: http://example.com/?querystring ? All webhosts I've used support this but is it safe to assume that all…
Chad
  • 2,365
  • 6
  • 26
  • 37
103
votes
4 answers

Are query string keys case sensitive?

Suppose I have a url like this: http://www.example.com?key=123&KEY=198 Then what will be result of request.querystring("key") and request.querystring("KEY") I am a bit confused.
100
votes
14 answers

How do I serialize an object into query-string format?

How do I serialize an object into query-string format? I can't seem to find an answer on google. Thanks. Here is the object I will serialize as an example. public class EditListItemActionModel { public int? Id { get; set; } public int State…
Benjamin
  • 3,134
  • 6
  • 36
  • 57
98
votes
6 answers

HttpServletRequest - Get query string parameters, no form data

In HttpServletRequest, getParameterMap returns a Map of all query string parameters and post data parameters. Is there a way to get a Map of ONLY query string parameters? I'm trying to avoid using getQueryString and parsing out the values.
JasonStoltz
  • 3,040
  • 4
  • 27
  • 37
93
votes
1 answer

When to use query parameters versus matrix parameters?

Query parameters: http://example.com/apples?order=random&color=blue Matrix parameters: http://example.com/apples;order=random;color=blue When should one use query parameters versus matrix parameters? Why can matrix parameters be used in the middle…
Gili
  • 86,244
  • 97
  • 390
  • 689
93
votes
5 answers

node.js http 'get' request with query string parameters

I have a Node.js application that is an http client (at the moment). So I'm doing: var query = require('querystring').stringify(propertiesObject); http.get(url + query, function(res) { console.log("Got response: " +…
djechlin
  • 59,258
  • 35
  • 162
  • 290