get

GET HTTP request payload

萝らか妹 提交于 2019-11-30 17:40:52
I am designing an API and I wonder if it is fine to send a JSON payload on a GET request? In this other question Payloads of HTTP Request Methods , we can find according to this link : HEAD - No defined body semantics. GET - No defined body semantics. PUT - Body supported. POST - Body supported. DELETE - No defined body semantics. TRACE - Body not supported. OPTIONS - Body supported but no semantics (maybe in the future). Does this mean that I should not send a GET request with a payload? Are there risks to do so? Like having some HTTP client libraries incapable of sending such a payload? Or

jquery $.GET parameters passing in the url

孤者浪人 提交于 2019-11-30 17:01:49
问题 this is a general-purpose way to make GET requests with Jquery: var loadUrl="mypage.php"; $("#get").click(function(){ $("#result").html(ajax_load); $.get( loadUrl, {language: "php", version: 5}, function(responseText){ $("#result").html(responseText); }, "html" ); }); I was wondering if I could pass parameters (Ex.language and version) directly in the Url(after urlencoding them): var loadUrl="mypage.php?language=php&version=5"; $("#get").click(function(){ $("#result").html(ajax_load); $.get(

Http get request in Android 2.3.3

时光总嘲笑我的痴心妄想 提交于 2019-11-30 16:09:58
I need help with sending HTTP GET request. My code is as follows: URL connectURL = new URL("url"); HttpURLConnection conn = (HttpURLConnection)connectURL.openConnection(); conn.setDoInput(true); conn.setDoOutput(true); conn.setUseCaches(false); conn.setRequestMethod("GET"); conn.connect(); conn.getOutputStream().flush(); String response = getResponse(conn); But it fails at getResponse(conn); Why? Caner GET request could be used like this: try { HttpClient client = new DefaultHttpClient(); String getURL = "http://www.google.com"; HttpGet get = new HttpGet(getURL); HttpResponse responseGet =

How to use $_GET parameter to make seo friendly urls?

百般思念 提交于 2019-11-30 16:08:17
I am using a PHP CMS that I've made myself. It fetches the $_GET parameter url and turns it into www.website.com/{url} . This CMS uses the $_GET parameter to get the file. So, if the url is index , then the CMS searches for the file index and returns the contents of the file. But now, I'm expanding the CMS to have an addition parameter like profile/{username} . How can I expand on it? I want my URL to say www.website.com/profile/{username} . How would I go about doing this? This is my current htaccess: RewriteEngine On RewriteRule ^(|/)$ index.php?url=$1 RewriteRule ^([a-zA-Z0-9_-]+)(|/)$

Http get request in Android 2.3.3

此生再无相见时 提交于 2019-11-30 16:02:05
问题 I need help with sending HTTP GET request. My code is as follows: URL connectURL = new URL("url"); HttpURLConnection conn = (HttpURLConnection)connectURL.openConnection(); conn.setDoInput(true); conn.setDoOutput(true); conn.setUseCaches(false); conn.setRequestMethod("GET"); conn.connect(); conn.getOutputStream().flush(); String response = getResponse(conn); But it fails at getResponse(conn); Why? 回答1: GET request could be used like this: try { HttpClient client = new DefaultHttpClient();

$_SERVER['argv'] with HTTP GET and CLI issue

倖福魔咒の 提交于 2019-11-30 15:57:09
问题 I'm trying to write down a script to fetch some online data; script should be invoked either by a cron job or php cli and with standard GET HTTP request . As stated on PHP website $_SERVER['argv'] should fit my needs: Array of arguments passed to the script. When the script is run on the command line, this gives C-style access to the command line parameters. When called via the GET method, this will contain the query string. However i can't get it to work with standard HTTP GET request. $

htaccess remove .php and keep query string

夙愿已清 提交于 2019-11-30 15:39:41
Here is my .htaccess file right now. RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ $1.php [NC,L,QSA] This works in the fact that it makes my pages accessible when not using the .php extension. Old = domain.com/test.php New = domain.com/test The bad thing is that when I send get data with the following link the data is not passed. I thought the QSA option did that, whats the deal? domain.com/test?id=1 Matching the entire query string and appending it to your new URL using a back-reference should work. RewriteEngine On

How to obtain the query string in a GET with Java HttpServer/HttpExchange?

假如想象 提交于 2019-11-30 14:43:20
问题 I am trying to create a simple HttpServer in Java to handle GET requests, but when I try to get the GET parameters for a request I noticed the HttpExchange class does not have a method for that. Does anybody know an easy way to read the GET parameters (query string)? This is how my handler looks like: public class TestHandler{ @Override public void handle(HttpExchange exc) throws IOxception { String response = "This is the reponse"; exc.sendResponseHeaders(200, response.length()); // need GET

Magento get price including tax in a none-template file

夙愿已清 提交于 2019-11-30 14:35:00
At the moment i am trying to get the product price including tax in a php file for my product feed. I have this code at the moment: $_product = Mage::getModel('catalog/product')->load($productId); $_priceIncludingTax = $this->helper('tax') ->getPrice($_product, $_product->getFinalPrice()); Problem is that since that of course the '$this->' part doesn't work so well from the file. Anyone know how i can still get the price including tax in this file? Alex You can get a helper-instance in any file using: Mage::helper('tax') Your full code is: $_product = Mage::getModel('catalog/product')->load(

Mixing GET with POST - is it a bad practice?

末鹿安然 提交于 2019-11-30 13:43:23
问题 Is it a bad practice to mix GET and POST? (note this is in PHP) e.g. <form action="delete.php?l=en&r=homepage" method="post"> <!-- post fields here --> </form> 回答1: Actually, this will send a POST request request to the server, so technically you aren't mixing the two together : you are using POST with url parameters. There is nothing fundamentally wrong with this, as long as you don't use your URL for parameters that should be in the form as hidden field. There are simple rules : you use GET