urlencode

How to pass multiple values for a single URL parameter?

孤人 提交于 2019-11-30 17:21:26
Is it possible to pass multiple values for a single URL parameter without using your own separator? What I want to do is that the backend expects an input parameter urls to have one or more values. It can me set to a single or multiple URLs. What is a way to set the urls parameter so it can have multiple values? I can't use my own separator because it can be part of the value itself. Example: http://example.com/?urls=[value,value2...] The urls parameter be set to just http://google.com or it can be set to http://google.com http://yahoo.com ... . In the backend, I want to process each url as a

URLEncoding a string with Objective-C

拜拜、爱过 提交于 2019-11-30 16:48:28
问题 I'm trying to URL encode a string to form a GET request from objective-c. NSString *params = @"'Decoded data!'/foo.bar:baz"; NSRunAlertPanel( @"Error", [params urlEncoded], @"OK", nil, nil ); This is the category extending NSString -(NSString *) urlEncoded { NSString *encoded = (NSString *)CFURLCreateStringByAddingPercentEscapes( NULL, (CFStringRef)self, NULL, (CFStringRef)@"!*'\"();:@&=+$,/?%#[]% ", kCFStringEncodingUTF8 ); return encoded; } So the first time I run it I get back

NSString with emoticons/emojis url encode

谁说胖子不能爱 提交于 2019-11-30 16:33:42
I am trying to take the contents of a UITextField that may contain special characters and emojis and turn it into something I can pass in a GET request to a PHP service. If I do not encode the string at all, the emojis show up just fine (I can see them in the DB and they come back to me properly)... but if I add special chars (~!@#$%, etc.) the GET request chokes. So I run the string through the url encoder: [commentText stringByAddingPercentEscapesUsingEncoding:NSNonLossyASCIIStringEncoding]; I am using the NSNonLossyASCIIStringEncoding to get the emojis out properly, which works, but using

Encrypt/Encoding an ID in URL string

廉价感情. 提交于 2019-11-30 15:49:56
问题 Just trying to do some security on my website and trying to figure out the best route to secure an ID. EXAMPLE: http://localhost/page.php?id=90 TO: http://localhost/share/22349234987sdsdf9sdf87423498asf9 I am using HTACCESS to do the share part. But would like to hide the '90' and try to discourage anyone from just adding random numbers to try and receive a different response. Any thoughts on how to create something like this, or if something already exists that works well with implementation

Encrypt/Encoding an ID in URL string

别说谁变了你拦得住时间么 提交于 2019-11-30 14:47:32
Just trying to do some security on my website and trying to figure out the best route to secure an ID. EXAMPLE: http://localhost/page.php?id=90 TO: http://localhost/share/22349234987sdsdf9sdf87423498asf9 I am using HTACCESS to do the share part. But would like to hide the '90' and try to discourage anyone from just adding random numbers to try and receive a different response. Any thoughts on how to create something like this, or if something already exists that works well with implementation? Security is a factor, so just trying to find the best solution out there... Hiding the ID is

URL encoding a string in bash script

我与影子孤独终老i 提交于 2019-11-30 13:39:40
I am writing a bash script in where I am trying to submit a post variable, however wget is treating it as multiple URLS I believe because it is not URLENCODED... here is my basic thought MESSAGE='I am trying to post this information' wget -O test.txt http://xxxxxxxxx.com/alert.php --post-data 'key=xxxx&message='$MESSAGE'' I am getting errors and the alert.php is not getting the post variable plus it pretty mush is saying can't resolve I can't resolve am can't resolve trying .. and so on. My example above is a simple kinda sudo example but I believe if I can url encode it, it would pass, I even

ab cookie 压力测试接口

我是研究僧i 提交于 2019-11-30 13:21:47
ab是apache自带的压力测试工具,近期需要压测一个接口,涉及使用post请求,并在其中带cookie。方法总结如下: 1. 发送cookie 方法1 -C key1=value1;key2=value2... 1 例: ab -n 1 -C "name=ball;age=99;sex=male" "http://wc.sogou.com/worldcup2018/test.php" 1 服务端可拿到name, age, sex三个cookie值 方法2 -H "Cookie: key1=value1;key2=value2..." 1 例: ab -n 1 -H "Cookie: name=ball;age=36" "http://wc.sogou.com/worldcup2018/test.php" 1 2. 发送post请求 方法 -T 'application/x-www-form-urlencoded' -p postfile 1 说明: 1. -T参数指明post数据编码,无需变化。 2. postfile是文件名,里面存放了所要发送的post数据。数据格式如下: key1=value1&key2=value2... 1 如果value包含&等特殊符号,则需要对value进行urlencode编码。当然,保险起见

How to escape URL-encoded data in POST with HttpWebRequest

て烟熏妆下的殇ゞ 提交于 2019-11-30 12:04:27
I am trying to send an URL-encoded post to a REST API implemented in PHP. The POST data contains two user-provided strings: WebRequest request = HttpWebRequest.Create(new Uri(serverUri, "rest")); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; request.Headers.Add("Content-Transfer-Encoding", "binary"); // Form the url-encoded credentials we'll use to log in StringBuilder builder = new StringBuilder(); builder.Append("user="); builder.Append(user); builder.Append("&password="); builder.Append(password); byte[] credentials = Encoding.UTF8

urlencoder和urldecoder的使用

泪湿孤枕 提交于 2019-11-30 11:31:32
今天传url的时候乱码了。先说情形,url中有searchText=中文的情形,后台new String(searchText.getBytes(ISO-8859-1),"gbk")来获取,jsp中的是GBK的编码,服务器用的是jboss,里面有个server.xml有如下配置。 <Connector port="80" address="${jboss.bind.address}" maxThreads="250" maxHttpHeaderSize="8192" emptySessionPath="true" protocol="HTTP/1.1" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" URIENCODING="UTF-8"/> 之前是没有uriencoding这个属性的,我给干掉,问题解决,这时候用的是默认值即ISO-8859-1。 关于server.xml的配置可以参考这个url的文档 http://docs.jboss.org/jbossas/guides/webguide/r2/en/html/ch02.html 问题解决的过程中

How to encode URL in Groovy?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 10:41:31
Is there a kind of URLEncode in Groovy? I can't find any String → String URL encoding utility. Example: dehydrogenase (NADP+) → dehydrogenase%20(NADP%2b) ( + instead of %20 would also be acceptable, as some implementations do that) aiolos You could use java.net.URLEncoder . In your example above, the brackets must be encoded too: def toEncode = "dehydrogenase (NADP+)" assert java.net.URLEncoder.encode(toEncode, "UTF-8") == "dehydrogenase+%28NADP%2B%29" You could also add a method to string's metaclass: String.metaClass.encodeURL = { java.net.URLEncoder.encode(delegate, "UTF-8") } And simple