get

Get the GET variables from a URL String

别来无恙 提交于 2019-11-27 20:14:15
Hey, say I have a url just being passed through my php is there any easy way to get some GET variables that are being passed through it? It's not the actual url of the page or anything. like a just have a string containing http://www.somesite.com/index.php?url=var&file_id=var&test=var Whats the best way to get the values for those variables? parse_str(parse_url($url, PHP_URL_QUERY), $array) , see the manpage for parse_str for more info. $href = 'http://www.somesite.com/index.php?url=var&file_id=var&test=var'; $url = parse_url($href); print_r($url); /* Array ( [scheme] => http [host] => www

How do i pass GET parameters using django urlresolvers reverse

空扰寡人 提交于 2019-11-27 20:06:32
问题 I am using django 1.2 and going from one view to another using the urlresolvers reverse method. url = reverse(viewOne) and I want to pass a get parameter, for example name = 'joe' so that in the viewOne if I do def viewOne(request): request.GET['name'] I will get joe how do I do that ? 回答1: GET parameters have nothing to do with the URL as returned by reverse . Just add it on at the end: url = "%s?name=joe" % reverse(viewOne) 回答2: A safer and more flexible way: import urllib from django.core

how to get GET variable's value in javascript? [duplicate]

半腔热情 提交于 2019-11-27 19:53:25
Possible Duplicate: Get query string values in JavaScript how can i get the get variable in javascript? i want to pass it in jquery function. function updateTabs(){ //var number=$_GET['number']; how can i do this? alert(number); $( "#tabs" ).tabs({ selected: number }); } var $_GET = {}; if(document.location.toString().indexOf('?') !== -1) { var query = document.location .toString() // get the query string .replace(/^.*?\?/, '') // and remove any existing hash string (thanks, @vrijdenker) .replace(/#.*$/, '') .split('&'); for(var i=0, l=query.length; i<l; i++) { var aux = decodeURIComponent

How can I send POST and GET data to a Perl CGI script via the command line?

人走茶凉 提交于 2019-11-27 19:07:30
I am trying to send a get or a post through a command-line argument. That is test the script in the command line before I test through a browser (the server has issues). I tried searching online, and I suppose I was probably using incorrect terminology because I got nothing. I know this is possible because I saw someone do it. I just don't remember how it was done. Thanks! :) Are you using the standard CGI module? For example, with the following program (notice -debug in the arguments to use CGI ) #! /usr/bin/perl use warnings; use strict; use CGI qw/ :standard -debug /; print "Content-type:

Whats the difference between GET and POST encryption?

不打扰是莪最后的温柔 提交于 2019-11-27 18:10:44
What is the difference when encrypting GET and POST data? Thx for answer Edit: i need to write it more specific. When https-SSL encrypts both of this methods, what is the difference in way browser does this. Which parts are encrypted and which are not? I somewhere read, that the destination url is not encrypted in POST, is that true? If it is true and same in GET, where are all the parameters? Edit2: still dont know the answer on my question. When both methods are encrypted with same data, does the look the same when sniffed? What parts are encrypted and which are not? Ben S GET data is

Parametrized get request in Ruby?

旧城冷巷雨未停 提交于 2019-11-27 18:08:05
How do I make an HTTP GET request with parameters in Ruby? It's easy to do when you're POST ing: require 'net/http' require 'uri' HTTP.post_form URI.parse('http://www.example.com/search.cgi'), { "q" => "ruby", "max" => "50" } But I see no way of passing GET parameters as a hash using 'net/http' . Chris Moos Use the following method: require 'net/http' require 'cgi' def http_get(domain,path,params) return Net::HTTP.get(domain, "#{path}?".concat(params.collect { |k,v| "#{k}=#{CGI::escape(v.to_s)}" }.join('&'))) if not params.nil? return Net::HTTP.get(domain, path) end params = {:q => "ruby",

Angular JS - request in order to get an image

99封情书 提交于 2019-11-27 18:06:13
问题 I would like to display a jpeg image on UI. For this, I request my service (GET method) and then I converted to base 64: $http({ url: "...", method: "GET", headers: {'Content-Type': 'image/jpeg'} }).then(function(dataImage){ var binary = ''; var responseText = dataImage.data; var responseTextLen = dataImage.data.length; for (var j = 0; j < responseTextLen; j+=1) { binary += String.fromCharCode(responseText.charCodeAt(j) & 0xff) } base64Image = 'data:image/jpeg;base64,' + window.btoa(binary);

How to send a Get request in iOS?

自作多情 提交于 2019-11-27 18:01:22
I am making a library to get response from a particular URL with specified data and method type. For this, I am making a request with url. But when I set its method type, it shows an exception of unrecognized selector send in [NSURLRequest setHTTPMethod:] I am setting it as [requestObject setHTTPMethod:@"GET"]; Tell me what could be the problem. Also provide me the code if you have. Mobile Developer iOS Android NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:serverAddress] cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:10 ]

get all the images from a folder in php

左心房为你撑大大i 提交于 2019-11-27 18:00:22
I am using WordPress. I have an image folder like mytheme/images/myimages . I want to retrieve all the images name from the folder myimages Please advice me, how can I get images name. sharif2008 try this $directory = "mytheme/images/myimages"; $images = glob($directory . "/*.jpg"); foreach($images as $image) { echo $image; } zur4ik you can do it simply with PHP opendir function. example: $handle = opendir(dirname(realpath(__FILE__)).'/pictures/'); while($file = readdir($handle)){ if($file !== '.' && $file !== '..'){ echo '<img src="pictures/'.$file.'" border="0" />'; } } Shafiqul Islam when

Correct use of C# properties

余生颓废 提交于 2019-11-27 17:56:15
问题 private List<Date> _dates; public List<Date> Dates { get { return _dates; } set { _dates = value; } } OR public List<Date> Dates { get; set; } I have always used the former, is that incorrect or bad practice? It never occurred to me that I could just use the second option. I do like having my encapsulated variables to begin with an underscore so I can distinguish them from method parameters. And I've just always done it that way. Is it possible that using the first option would result in an