post,lisp,common-lisp,hunchentoot , Can't get the post in LISP hunchentoot


Can't get the post in LISP hunchentoot

Question:

Tag: post,lisp,common-lisp,hunchentoot

I try to implement a simple post example based on Hunchentoot.

Here is the code:

(define-easy-handler (test :uri "/test") () 
  (with-html-output-to-string (*standard-output* nil :prologue t :indent t)
    (:html 
     (:body
      (:h1 "Test")
      (:form :action "/test2" :method "post" :id "addform"
     (:input :type "text" :name "name" :class "txt")
     (:input :type "submit" :class "btn" :value "Submit"))))))

(define-easy-handler (test2 :uri "/test2") (name)
  (with-html-output-to-string (*standard-output* nil :prologue t :indent t)
    (:html 
     (:body
      (:h1 name)))))

I can correctly connect to http://127.0.0.1:8080/test and see the text input form. But when I submit the text, I get a blank page where I expected a page with the title given in text input.

Not sure what is wrong, can anyone advice?


Answer:

Change your handler to this

(define-easy-handler (test2 :uri "/test2") (name)
  (with-html-output-to-string (*standard-output* nil :prologue t :indent t)
    (:html 
     (:body
     (:h1 (str name))))))

Then it should work. Read the cl-who documentation. Especially the information on local macros. I am including the relevant documentation here.

A form which is neither a string nor a keyword nor a list beginning with a keyword will be left as is except for the following local macros:


Related:


How can I post form into same php page and intercept it?


php,forms,post
I'm trying to submit a form to same page, so I want submit data, and then save into DB... And then update my page with new data... I do it in this way: <?php if (isset($_POST["matricola"]) && isset($_POST["pc"])){ echo "QUI"; $conn = dbConnect($USERDB, $PASSWORDDB, $NAMEDB); //seleziono il database e mi...

error write large file got request entity too large


javascript,node.js,post,stream,fs
I use the following code to send from the browser body(via postman ) file content which is large file. before for small file I use the following which work perfect fs.writeFile(filePath, req.body, 'utf8', function (err) { ... now I use the following app.post('/bb',function(req,res){ var filePath = 'C://test.txt'; var writeStream =...

attempting to alter data via POST and ajax in django not working


jquery,ajax,django,post
I want to be able to click a button that will change data using ajax (jquery). Here is what I am doing now: html/js: <button onclick="alterData('some sort of data')">click me!</button> function alterData(someInput){ $.ajax({ type: 'POST', url: '/home/alter/', data: {someInput: someInput}, }); } urls.py: urlpatterns = [ ... url(r'^alter/',views.alter), ... ]...

jQuery / Ajax: How to pass JS variable to specific PHP function [closed]


php,jquery,ajax,post
I am new to PHP and never used Ajax before so I hope someone can help me with this. I have a separate functions.js file that stores all the JS I use for the pages of a website. So far all the exchange with the db is done with PHP...

Pass variable from Javascript to PHP to write to file


javascript,php,html,post
It could be duplicate cause unable to find answer even by searching similar questions of Stackoverflow. This is what I am trying to do. I need to pass a stored variable in JavaScript to PHP which would write it to temp file 'yy.html'. I could get alert from the submit...

How to use button instead input, style input?


css,forms,jsp,servlets,post
My form: <form method="POST" action="AController"> <div class="userInput"> <table class="userInput"> <tr> <td><input type="text" id="username" name="login"></td> </tr> <tr> <td><input type="submit" id="submitRegInput" name="reg" value="Submit"></td> </tr> </table> </div> </form> I'm trying to style <input type="submit" id="submitRegInput" name="reg" value="Submit"> like this: #submitRegInput { background: no-repeat...

Reveal info by clicking on link


arrays,post,hyperlink,get
I have 4 links: <a href=""><img src="img/photo1.jpg" /></a> <a href=""><img src="img/photo2.jpg" /></a> <a href=""><img src="img/photo3.jpg" /></a> <a href=""><img src="img/photo4.jpg" /></a> I also have md array: $users = [ "id_1" => [ "personal_id" => "111111", "name" => "Arthur Novickov", "location" => "Moskow", "age" => "22", "status" => "online" ], "id_2" =>...

How to get POST parameters from CGI scripts written in bash?


bash,shell,post,cgi
I'm writing a web application using CGI scripts written in bash. For GET requests, the request parameters are available in a variable named $QUERY_STRING. However, I'm unable to figure out where the similar value would be stored for POST requests. I'm using the following script: #!"c:/msys64/usr/bin/bash.exe" # On *nix, replace...

Python POST request can't find data attribute


python,django,post
I'm trying to write a POST request to my Django REST API in Python, but it can't seem to find an attribute in the data section of the request. Here's the function that handles the request: def post(self, request, id, format=None): obj = self.get_object_or_404(id) operation = request.POST.get('operation', None) if operation...

Alternative to using mechanize to fetch data?


python,post,python-requests,developer-tools,mechanize-python
Currently, I am using mechanize to fill up a form and send a POST request, then I am doing a regex search on the response to get the data ( a floating point number). Is there any way I can do this by just sending a POST request? I know...

Why I cannot get action from ajax post request


javascript,jquery,ajax,post
Here is my code: $(document).ready(function(){ $("#mainbutton").click(function(){ $("#ajaxform").submit(function(e) { $.ajax( { action : "mainbutton", url : "userctrl", type: "post", data : $(this).serializeArray(), success:function(data, textStatus, jqXHR) { alert("success"); }, error: function(jqXHR, textStatus, errorThrown) { alert("error"); } }); }); $("#ajaxform").submit(); //Submit the form }); }); I try to set action in this post...

Java Servlet - get parameters with same name


java,java-ee,servlets,post
I know that I can get parameter like: HTML <input type="text" name="field" value="test"> Servlet String field = request.getParameter("field"); But what if I have multiple input with same name like: HTML <input type="text" name="line[]" value="test1"> <input type="text" name="line[]" value="test2"> <input type="text" name="line[]" value="test3"> In PHP I can just use name="line[]" to...

Recreating Ajax POST


javascript,ajax,post
I want to recreate Ajax POST which I can peak via Chrome's debugger. I created post like this: $.ajax({ method: "POST", url: url, contentType: "application/json; charset=UTF-8", data: { "defaults": "default", "culture": "en-US", "skip": 20, "take": 20, "query": "", "filters": [], "fulltext": [], "sorting": { "field": "ModifiedOn", "asc": false } }...

Web API translating input into random int


c#,post,asp.net-web-api,json.net
not sure whether the subject is the best description for this problem but I am getting an unusual problem where I have a single Web API operation and a single field on a request and for some odd reason the value gets manipulated. Depending on the input this gets converted...

Invalid specialized parameter in method lambda list


lisp,common-lisp
I am trying to write a simple coin flip program in Common Lisp. This is the code I have (defun yn (let ht (random 1) (if (eq ht 1) (princ heads) (princ tails)) ) ) It seems simple enough, but I keep getting the error: "Invalid specialized parameter in method...

using requests to login to a website that has javascript login form


javascript,python,ajax,post,python-requests
Let me preface by saying I have very little programming experience. I've learned a bunch in the last few days trying to write this program. I am running Python 2.7 on Windows 7 using PyCharm, requests, Beautiful Soup, and lxml. I am trying to scrape data from a website that...

If strings are vectors, why are they immutable?


lisp,common-lisp
if strings are vectors of characters, and a vector's elements can be accessed using elt, and elt is setf-able - then why are strings immutable?

Sending data from a client to a server by means of a http post


php,python,post,python-requests
I'm trying to send data from the client to the server. The client runs a simple python script that uses the 'request' library. The server side consists of another simple php script using the $_POST. I need the webpage to update depending on the data that is given through the...

ElasticSearch asynchronous post


database,post,asynchronous,elasticsearch,get
I'm posting data on my ElasticSearch database. I've noticed that data is not immediately available, it requires some milliseconds to show up in a GET request. I can live with that (after all, the calls are asynchronous so this behavior is expected) but in my test code I need to...

in clojure, function argument type mismatch


clojure,functional-programming,lisp
clojure, function argument is vector, but it takes a map without problem. (defn flower-colors [colors] (str "The flowers are " (:flower1 colors) " and " (:flower2 colors))) (flower-colors {:flower1 "red" :flower2 "blue"}) ;; -> "The flowers are red and blue" Function flower-colors suppose to take vector type argument, but with...

Proper way to use PDO with mass amount of INSERT Values


php,mysql,post,pdo
I am using PDO to insert into a MySQL DB input from users on a form with 10 input fields. I make a numeric array containing the $_POST values by doing this: foreach ($_POST as $key => $val) { //testInput() sanitizes the input $postArray[] = testInput($val); } From all the...

How to POST - API in thingspeak.comusing urllib in Python


python,api,post,urllib
I am working on a project where I have to get data from a website and then post it to a different website. At the moment I am still new, so I am using a thingspeak.com account to experiment on posting, and I am also following the same example used...

Structuring large Lisp applications


lisp,common-lisp,quicklisp,asdf
I am currently trying to wrap my head around packages, systems & co. I now have read Packages, systems, modules, libraries - WTF? a few times, and I think I'm still having difficulties to get it right. If I simply want to split a Lisp source file into two files,...

MySQL multi SELECT query into form and then UPDATE


php,mysql,forms,variables,post
What i am trying to accomplish is Getting data from MySQL database into a table only containing rows where a user forgot to log in or out(done) Change the data in the table (done) Click submit and it updates all the data in the table into the MySQL database I...

Passing Two Parameters on a JSON POST Request in Rspec


ruby-on-rails,ruby,json,post,rspec
I have a JSON Rails 4 API that I'm testing with Rspec. I'm having trouble passing to two parameters in the post :create request. Here is the current test: require 'spec_helper' module Api module V1 describe Api::V1::ProductsController, type: :controller do before do @api_app = FactoryGirl.create(:api_app, request_origin: "0.0.0.0") @store = FactoryGirl.create(:store)...

Insertion into a list doesn't reflect outside function whereas deletion does?


list,lisp,common-lisp
I am new to Lisp. Deletion of an item in a list by a function gets reflected outside the function but insertion doesn't. How can I do the same for insertion? For example (defun test (a b) (delete 1 a) (delete 5 b) (append '(5) b) (member '5 b)) (setq...

Is sending data using $_SESSION instead of $_POST a good thing?


php,post
I saw many , many questions about sending data using $_POST without form. Let's say that we receive from another web (e.g. through their API) and the page that we told the API the return the data is receive.php and we want that data to be accessible from every page...

WordPress post details


wordpress,post
I have WordPress page in which post titles of a single category are showed. When the user clicks any of the post a new tab should open and show the details of the post on which the user clicked how will I do this.

how to post parameter like {“register_id”:“3”} in AFNetwroking


post,methods,parameter-passing,afnetworking,raw-data
i Tried it but didn't work in AFNetworking only showing parameters error but i used postman to check and when i send data via key and value it showing error but from raw data i send {"register_id":"3"} then it will show me data so how to post parameter like this...

php - Send data from one php page to another and refresh it with the new data


php,json,post
i'm trying to the following: I have 1 page that is called request.php that receives a post from a webhook of hipmob Documentation: https://www.hipmob.com/documentation/chat-events.html <?php $entityBody = file_get_contents('php://input'); $post_data = $_POST; $data = json_encode($post_data, JSON_PRETTY_PRINT); $file = 'webhook.txt'; $current = file_get_contents($file); file_put_contents($file, $data); //error_log($data); ?> Example output: { "app": "eba978375b294260bd884a72afd5eb75",...

Mule Server 3.6 > Anypoint Studio > Request Connector


json,post,mule,esb,mule-studio
How do I set the Request Connector to send Raw JSON data using POST method? On my Set Payload transformer I have this: #[{ "productId": #[sessionVars.productId] }] When I run my Mule App, I get the following error: Error sending HTTP request. Message payload is of type: String What am...

How to execute POST using CURL


post,curl,asp-classic
How to execute POST using CURL, i have this basic .asp that receives the data via POST and show the result in .JSON format. <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <% Response.ContentType = "application/json" Response.Write("{ ""responseCode"": " + Request("responseCode") + ", ""publication_id"": " + Request("publication_id") + ", ""version"": " + Request("version") + "}") %>...

JSF link to external site without showing username and password in the URL


jsf,post,single-sign-on,commandlink
I was able to do a SSO(Single sign on) on click of external link from the code below. SSO works but username/password is seen on url. https://example.org/index.php?userLogin=user1&userPassword=pass123 <h:outputLink styleClass="ui-menuitem-link ui-corner-all" value="https://example.org/index.php"> <h:outputText value="Ext Tool" /> <h:outputText styleClass="ui-icon ui-icon-suitcase" style="float:left" rendered="#{userBean.in}" /> <f:param name="userLogin" value="#{userBean.user.eUser}" /> <f:param...

REST API design for cloning a resource


api,rest,post,yaml,webdav
I am writing a YAML document using swagger to design a RESTful API method for cloning a resource. I have a few options and don't know which would be best. Please can someone advise? Options: Relinquishing the responsibility of cloning the resource object to the consumer (where the consumer assigns...

Jquery : inject response from AJAX posts into right div


jquery,ajax,post
This is driving me insane. Here's what I'm trying to do; For every DIV on my page that has a class of 'gauge', I need to fire off a jquery Post request via Ajax, containing some parameters from a ViewModel (called 'params' in the code snippet below). The ID of...

Exceed evaluation depth when forward function in Emacs Lisp


emacs,lisp,elisp
Here is just a simplified code snipped I have not managed to work. I do not understand what is wrong. (defun enumerate-indicies (func) (let ((index 0)) (while (< index 5) (funcall func index) (setq index (1+ index))))) (defun enumerate-multiplied-indicies (func) (enumerate-indicies #'(lambda (index) (funcall func (* 10 index))))) The following...

EVAL/APPLY: too many arguments given to F


lisp,common-lisp,clisp
Hello why do i get *** - EVAL/APPLY: too many arguments given to F on function call with nested lists parameter. I cannot figure it out, since I passed a simple nested list. (defun f (L) (cond ((NULL l) nil) ((listp (car L)) (append (F(car L))) (F(cdr L) (car (F...

Adding Post data to XML String


php,xml,post
I collect data from a form like this : $title = $_POST["title"]; $fname = $_POST["first_name"]; $surname = $_POST["surname"]; I want tot build an XML String and add the above post data. I have tryed the following and none of it works. It has to use "" double quotes ! $XPost...

Radio Button INPUT not sending the input to the PHP code


php,forms,post,radio-button
The code is given below shows the errors : <div class="field form-inline radio"> <form method="post" action=""> <div> <label><input type="radio" name="eatable" value="fruit_in"/> Fruit</label> </div> <div> <label><input type="radio" name="eatable" value="vegetable_in"/> Vegetable</label> </div> <div> <label><input type="radio" name="eatable" value="bread_in"/> Bread</label> </div> <div> <label><input type="radio"...

PHP: Submitting form data via $_POST works for all fields except radio buttons


php,forms,post,radio-button,radio
I am new to PHP and hope someone can help me with this. I have an HTML form with a number of inputs and textareas. On Submit I pass the form to another PHP page that generates an email with its values. For text inputs and textareas everything works as...

How send Sever Sent Events on POST using PHP?


php,post,server-sent-events
I'm just starting with PHP and Server Sent Events. After checking out a couple of articles,like the W3C and HTML5Rocks one I was able to get something off the ground very fast. What I'm trying to do now is sending a Server Sent Event when my php script receives a...

Backquote String Interpolation


macros,lisp,common-lisp
Is it possible to use lisp's macro to do string interpolation? For instance, can I make a macro like this: (defmacro test (a) `",a") So that (test abc) returns "abc" as a string? I could probably cheat by quoting it and turning that quote into a string, but that doesn't...

How to work arround php notice raised incorrecty when posting a string that begins with an @?


php,post,curl,encoding
I want to perform a post request using PHP and Curl. This is how I set my post parameters: curl_setopt($ch,CURLOPT_POSTFIELDS,array('name'=> $name)); When the String in $name happens to contain an @ character at the beginning I get the following error. [8192] curl_setopt(): The usage of the @filename API for file...

Handling POST request via Socket in Java


java,sockets,http,post,request
I'm trying to handle a simple POST Request in Java using a Socket. I can receive the request header and answer the request without any problem, but I certainly can not get the body of the request. I read somewhere that I'd need to open a second InputStream to achive...

Android post request in php


php,android,laravel,post
I'm trying to make a php script send an email whenever I make a post request. If I load my website in a web browser, it indeed sends a mail. But whenever I send a post request in Android (calling the postData method), nothing happens. Why doesn't it work? public...

Sending Post method manually using Python


python,post
I want to send a post request using python for some specific reason. To be more specific i want to sent '12064608' into "code national" in this website http://bac.menara.ma/ministere/ . The problem is that if I send it manually the respond is not the same as if we send enter...

Some Form Inputs didn't sent via GET / POST [duplicate]


php,html,post,get
This question already has an answer here: Disabled form inputs do not appear in request 4 answers Here is My Update Item.php <!DOCTYPE html> <html lang="en"> <head> <style type="text/css"> input[type='text'],input[type='number'],input[type='date']{ color:#0000FF; background-color:#FFFFCC; } </style> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta...

JSP form sending data including files in servlet


java,jsp,servlets,post,get
I am tryig to send some data from jsp form to a servlet. All my data are type="text" except from one that is type="file". I know that if i want to send the data to my servlet, i have to use request.getParameter(...). (My data) In order not to be null...

Getting numbers from form via POST, not working, PHP


php,forms,post,get
I have 2 files. I'm trying to get the POST from one file to another, yet it's showing up as null for some reason. Please take a look: testx1.php <?php echo "<form method = 'post' action = 'testx2.php'>"; echo "<input type = 'number' name = 'number'>"; echo "<input type =...

php - Receive webhook data from hipmob


php,post,request
I'm trying to receive a webhook from hipmob (live chat app) that should be triggered at a chat event. Documentation: https://www.hipmob.com/documentation/chat-events.html I've been following How to catch the HTTP POST request sent by a Shopify Webhook , and i have to say that i am completly new to this. I...