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

Can't get the post in LISP hunchentoot


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)
      (: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)
      (:h1 name)))))

I can correctly connect to 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?


Change your handler to this

(define-easy-handler (test2 :uri "/test2") (name)
  (with-html-output-to-string (*standard-output* nil :prologue t :indent t)
     (: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:


Passing Two Parameters on a JSON POST Request in 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: "") @store = FactoryGirl.create(:store)...

WordPress post details

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.

Why I cannot get action from ajax post request

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...

Reveal info by clicking on link

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" =>...

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

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...

Web API translating input into random int

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...

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

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...

ElasticSearch asynchronous post

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...

EVAL/APPLY: too many arguments given to F

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...

Jquery : inject response from AJAX posts into right div

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...

Mule Server 3.6 > Anypoint Studio > Request Connector

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...

Android post request in php

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...

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

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...

Backquote String Interpolation

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...

Invalid specialized parameter in method lambda list

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...

in clojure, function argument type mismatch

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...

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

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: <?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",...

Recreating 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 } }...

If strings are vectors, why are they immutable?

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?

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

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...

Adding Post data to XML String

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...

Handling POST request via Socket in Java

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...

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

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...

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

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}, }); } urlpatterns = [ ... url(r'^alter/',views.alter), ... ]...

JSP form sending data including files in servlet

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...

Radio Button INPUT not sending the input to the PHP code

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"...

How send Sever Sent Events on POST using PHP?

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...

Exceed evaluation depth when forward function in Emacs Lisp

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...

Alternative to using mechanize to fetch data?

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...

Java Servlet - get parameters with same name

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...

REST API design for cloning a resource

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...

Pass variable from Javascript to PHP to write to file

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 POST - API in thingspeak.comusing urllib in Python

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 account to experiment on posting, and I am also following the same example used...

Sending Post method manually using Python

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 . 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]

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...

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

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...

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

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...

MySQL multi SELECT query into form and then UPDATE

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...

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

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. <h:outputLink styleClass="ui-menuitem-link ui-corner-all" value=""> <h:outputText value="Ext Tool" /> <h:outputText styleClass="ui-icon ui-icon-suitcase" style="float:left" rendered="#{}" /> <f:param name="userLogin" value="#{userBean.user.eUser}" /> <f:param...

Proper way to use PDO with mass amount of INSERT Values

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...

Structuring large Lisp applications

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,...

error write large file got request entity too large

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'/bb',function(req,res){ var filePath = 'C://test.txt'; var writeStream =...

How to use button instead input, style input?

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...

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

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...

Python POST request can't find data attribute

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...

Getting numbers from form via POST, not working, PHP

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 =...

How to execute POST using CURL

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") + "}") %>...

php - Receive webhook data from hipmob

I'm trying to receive a webhook from hipmob (live chat app) that should be triggered at a chat event. Documentation: 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...

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

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...

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

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...