Passing a parameter to a webhook - twilio

Want to pass and retrieve a query string to my twilio webhook.
http://xx.xx.xxx.xx/TwilioWebhookTraffic/TwilioWebHookTraffic.aspx/TrafficCallBack?GCAcctNbr=667118358011603
which returns:
<!DOCTYPE html>
<html
xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<form method="post" action="./TrafficCallBack?GCAcctNbr=667118358011603" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="4PSLlcjmwjYT0iXthm7eB3EX5v8lZY62GKDxWDdNDuZndwHLxahDzcX2H0NFNQX+2NAe7hPownCNYxJJVZJreGwJpqZ/Cwm3f2EIiLGFQ4c=" />
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="CFB6114E" />
<div>
TWILIO TRAFFIC REMINDER WEBHOOK ASPX PAGE</div>
</form>
</body>
</html>
But does not run the webhook code.
if the URL is just:
http://xx.xx.xxx.xx/TwilioWebhookTraffic/TwilioWebHookTraffic.aspx
then the code is run. but, of course I need the query string.

Related

Thymeleaf 3 #request object is null in inline Javascript

I have below code in a web page in Spring Boot 2 web app:
<div data-th-fragment="head-section">
<div> blah </div>
<script data-th-inline="javascript">
var url = [[${#request.requestURL} ]];
var country = [[${#locale.country}]]
</script>
</div>
Thymeleaf throws error that says cannot get requestURL on null while it correctly gets the locale. Thymeleaf 3 official documentation says #request and #locale are valid objects in web context.
How to fix this issue?
Just Metroids mention and Refer to Spring boot getting started Securing a Web Application User #httpServletRequest is not null. is an instance of HttpServletRequestWrapper
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
<title>Hello World!</title>
</head>
<body>
<h1 th:inline="text">Hello [[${#httpServletRequest.remoteUser}]]!</h1>
<form th:action="#{/logout}" method="post">
<input type="submit" value="Sign Out"/>
</form>
</body>
</html>

How to get the value by GET method from URL Parameter?

I have a problem with this script:
<form action="edit.php" method="GET">
<a class="btn btn-default" href="editj.php?id=3">Edit</a>
</form>
in my edit.php file i have:
<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"xml:lang="pl" lang="pl">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta http-equiv="content-langiage" content="pl" />
<title>Praca inżynierska</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="kontener_glowny">
<?php
include 'topmenu.php';
?>
<div id="kontener">
<?php
$id = $_GET['$id'];
echo $id;
?>
</div>
<div id="stopka">
Stopka
</div>
</div>
</body>
</html>
and my web browser show me error: Notice: Undefined index: $id in M:\xampp\htdocs\apka\edit.php on line 19.
I have no idea how can i get value of my argument which i have in link,
this script should show me id=3.
Simply use $_GET['id'] instead of $_GET['$id']

Strange cflocation behavior: redirecting to page but not updating url

I have a basic mobile login page in ColdFusion that allows the user to enter a username and password and log in. On successful login, the page redirects to the home page using a cflocation. However, while the page redirects successfully to the home page, it still displays the login page URL in the location bar. We have used cflocation many times throughout our web application and I have never come across this behavior before and can't figure out what could be causing it.
The gist of the page code:
<cfparam name="invalidLogin" default="false">
<cfif cgi.REQUEST_METHOD EQ "POST" AND isDefined("form.email") AND isDefined("form.password") and len(trim(form.email)) and len(trim(form.password))>
<!--- call the login method --->
<cfinvoke component="login" method="userlogin" returnvariable="userData">
<cfinvokeargument name="userName" value="#form.email#">
<cfinvokeargument name="password" value="#form.password#">
</cfinvoke>
<cfif userData.isLoggedIn>
<cflocation url="index.cfm" addtoken="no">
</cfif>
<cfset invalidLogin = true />
</cfif>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Log In</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/jquery.mobile.structure-1.3.2.css" rel="stylesheet" type="text/css" />
<link href="css/jquery.mobile-1.3.2.css" rel="stylesheet" type="text/css" />
<link href="css/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.3.2.js"></script>
<script type="text/javascript" src="js/common.js"></script>
</head>
<body>
<div data-role="page" class="bg-color">
<div class="container">
<div data-role="content">
<div class="article">
<div class="logoDiv">
<img src="img/companyLogo.png" />
</div>
</div>
<form action="" method="post" name="frmLogin" id="frmLogin" class="margin-top" data-transition="slide">
<div>
<input type="text" name="email" id="email" placeholder="Username">
<input type="password" name="password" id="password" placeholder="Password">
</div>
<cfif invalidLogin><div>Invalid Login</div></cfif>
<div>
<input type="submit" value="Log In" data-theme="b" />
</div>
</form>
</div>
</div>
</div>
</body>
</html>
To prevent jQuery Mobile from handling forms with redirect via Ajax, you need to turn Ajax Navigation off and handle the request through HTTP.
To do so, add data-ajax="false" attribute to form tag. This will stop Ajax Navigation on the form only.
Note that you will lose transition when moving for current form page to new page as Ajax is turned off, so data-transition="slide" will have no effect.
<form action="" data-ajax="false" method="post" name="frmLogin" id="frmLogin">

Checkbox onclick and onchange event called twice, please see simple example

If i comment out the jquery.mobile...js file, this works fine, with it included, everytime i click the checkbox, the onclick event fires twice. Same is true for onchange event. Any ideas?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>
<body>
<script>
function tester() { alert("I get called twice on click"); }
</script>
<input id="abc" name="myCheckbox" onchange="tester()" type="checkbox" value="true" />
<label for="myCheckbox">Click me</label>
</body>
</html>
This is by design, since both events are happening. See example: http://jsfiddle.net/Twisty/T3qmG/
HTML:
<html>
<head>
<title>Checkbox Test</title>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h2>Checkbox Test</h2>
</div>
<div data-role="content">
<input type="checkbox" id="checkbox-choice-1" />
<label for="checkbox-choice-1">Click me</label>
</div>
</div>
</body>
</html>
JQuery:
$(document).ready(function(){
$("#checkbox-choice-1").click(function(){
alert("Click event triggerd.");
});
$("#checkbox-choice-1").change(function(){
alert("Change event triggerd.");
});
});
I would advise separating your script code if possible. You can a function to one or both events.
Your markup is malformed. The <label> tag points to a non-existent id. It points to "myCheckbox" but the id of your input tag is "abc". This change fixes your issue and the markup is correctly enhanced.
<input id="abc" name="myCheckbox" onchange="tester()"
type="checkbox" value="true" />
<label for="abc">Click me</label>

cross-domain post iframe

I want to POST data from my FORM to an IFRAME which is found on another domain. Is there any easy way to do this?
<iframe name="iframe" width="100" height="100" src="www.otherdomain.com" />
<form action="www.mydomain.com" method="post" target="iframe">
<input type="text" name="text1" value="123" />
<input type="text" name="text2" value="456" />
<input type="submit" value="submit"/>
</form>
I think your example should work. I've set two virtual hosts pastefrom.com pasteto.com
on my localhost.
http://pastefrom.com/index.html:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>test</title>
</head>
<body>
<iframe name="iframe" id="iframe" src="http://pasteto.com/index.php" width="500" height="500"></iframe>
<form action="http://pasteto.com/index.php" method="post" target="iframe">
<input type="text" name="search" value="google" />
<input type="submit" value="submit"/>
</form>
</body>
</html>
http://pasteto.com/index.php:
<pre><?php var_dump($_POST);?></pre>
And on submit it shows post data on pasteto.com
array(1) {
["search"]=>
string(6) "google"
}

Resources