Use curl to post data to a form? - forms

I have a form like this:
<form method="post" enctype="multipart-form-data" name="my_form" action="http://www.sms-online.web.id/kirim" >
<input class="field text small" type="text" maxlength="20" name="Phonenumbers" />
<br />
<textarea rows="5" cols="20" onKeyPress=check_length(this.form); onKeyDown=check_length(this.form); name=Text ></textarea>
<br />
<input id="saveForm" class="btTxt" type="submit" value="KIRIM" name="TOMBOL" />
</form>
Let's say that form is located at http://myurl.com/form How do I post to that form and then click the submit button? and what my file should look like? should it look like this or not:
Phonenumbers=08111111
Text=SMScontent
I already tried this but didn't work:
curl --data "Phonenumbers=0811111&text=testing&TOMBOL=KIRIM" http://myurl.com/form
I tried #sputnick suggestion but got the following error:
<!DOCTYPE html>
<html style="height:100%">
<head><title> 301 Moved Permanently
</title></head>
<body style="color: #444; margin:0;font: normal 14px/20px Arial, Helvetica, sans-serif; height:100%; background-color: #fff;">
<div style="height:auto; min-height:100%; "> <div style="text-align: center; width:800px; margin-left: -400px; position:absolute; top: 30%; left:50%;">
<h1 style="margin:0; font-size:150px; line-height:150px; font-weight:bold;">301</h1>
<h2 style="margin-top:20px;font-size: 30px;">Moved Permanently
</h2>
<p>The document has been permanently moved.</p>
</div></div><div style="color:#f0f0f0; font-size:12px;margin:auto;padding:0px 30px 0px 30px;position:relative;clear:both;height:100px;margin-top:-101px;background-color:#474747;border-top: 1px solid rgba(0,0,0,0.15);box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset;">
<br>Proudly powered by <a style="color:#fff;" href="http://www.litespeedtech.com/error-page">LiteSpeed Web Server</a><p>Please be advised that LiteSpeed Technologies Inc. is not a web hosting company and, as such, has no control over content found on this site.</p></div></body></html>

You have a typo in the Text field (need to capitalize) so :
curl -d "Phonenumbers=0811111&Text=testing&TOMBOL=KIRIM" http://myurl.com/form
# ^
and to do such things, use cookies and a fake user-agent. Check
man curl

Use the -F flag to POST multipart-form-data as in:
curl -F "Phonenumbers=0811111&Text=testing&TOMBOL=KIRIM" http://myurl.com/form

You can use
curl--data "dob=2018&press=OK" http://blog.eduguru.in/testapp.cgi

Related

Disable similar results from list.js

I use list.js, but it displays also similar results. For example I am typing Mar..., website displays also mur, car, man and etc. How can I disable them?
It is demo from codepen:
<p class="codepen" data-height="265" data-theme-id="0" data-default-tab="html,result" data-user="javve" data-slug-hash="isInl" style="height: 265px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;" data-pen-title="List.js - Fuzzy search">
<span>See the Pen <a href="https://codepen.io/javve/pen/isInl/">
List.js - Fuzzy search</a> by Jonny Strömberg (#javve)
on CodePen.</span>
</p>
<script async src="https://static.codepen.io/assets/embed/ei.js"></script>
You are using fuzzy-search, if you change <input type="text" class="fuzzy-search" /> to <input type="text" class="search" /> it works.
check it Codepen

How to solve Suspicious Link error in email which is sent from website

I'm sending a reset password email from my Go RESTFUL web service to our users and I'm using Go SMTP and google Gsuite domain which info#mycompanyname.ca! I've tested it before and it works but when I send it to one of our users he gets Suspicious Link error. He's using the Gmail website. I checked the https and both my website and links are https and When he forwards the email to me I don't see this error anymore! Can anybody help me with this?
This is my code :
mime string = "MIME-version: 1.0;\nContent-Type: text/html;
charset=\"UTF-8\";\n\n"
hostname string = "smtp.gmail.com"
auth := smtp.PlainAuth("", username, password, hostname)
data := map[string]string{"Token": token}
buffer := new(bytes.Buffer)
t, err := template.ParseFiles(htmlFilename)
if err != nil {
return err
}
err = t.Execute(buffer, data)
if err != nil {
return err
}
msg := []byte(subject + mime + buffer.String())
reciever = append(reciever, clientMail)
return smtp.SendMail(hostname+":587", auth, "", reciever, msg)
}
And this is HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1, maximum-scale=1.0, shrink-to-fit=no" name="viewport">
<meta name="author" content="some name">
<meta name="description" content="Entry HTML page for the dashboard">
</head>
<body style="max-width: 50rem; margin: auto; margin-top: 1rem;">
<img src="https://address in google drive" style="margin:auto;
display: block; width: 17rem; height: 4.6rem; position: relative; left: 50%; transform: translateX(-50%);"
alt="logo" title="company logo" />
<div style="margin-top: 0.5rem; padding-left: 0.5rem; padding-right: 0.5rem; border-top: 1px solid lightgray;
border-bottom: 1px solid lightgray; background-color: #f9f9f9">
<h3>Hello!</h3>
<p>You receive this email because this is your first time logging in. To enter your account,
you will need to set a password. Click the button below to set it.</p>
<div style="text-align: center">
<a href="https://websiteAddress/#/changepasswordapi?token={{ .Token }}" target="_blank">
<button style="cursor: pointer; border: none; width: 50%; background-color: #ED5E28;
color: white; font-size: 1rem; height: 2.5rem;
border-radius: 0.35rem"><strong>Set Password</strong></button>
</a>
</div>
<p>If you didn't request this, please ignore this email. The password setup is only valid for the next 24 hours.</p>
<p>Thanks,</p>
<p>compaynName Team</p>
</div>
<div style="text-align: center; font-size: 0.8rem; color: gray">
<p>© 2019 companyName. All rights reserved.</p>
<p>company addr</p>
<P>company city</P>
</div>
</body>
</html>
Alright, I solved this problem. At first, I thought that might be G Suite problem, So I called them and I realized it's not because I could see our email in the inbox and not in the spam folder. So I tried this link and I request a review for our domain. After about 30 hours the problem was gone!

Scala Play forms

I have a strange issue i cannot explain. i am using the play framework and when i try to run the View below it only works when i REPEAT the form action below... it works but i know it's not right. appreciative if anyone can help explain or correct.
#(errorMessage: String = "")(implicit messages: Messages)
#helper.form(routes.ApplicationHomeController.login) {
#main(title = messages("single.title")) {
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,700" rel="stylesheet" type="text/css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<div id="userbox">
<form action="#{routes.ApplicationController.doLogin()}" method="post"></form>
<form action="#{routes.ApplicationController.doLogin()}" method="post">
<div style="color: red">#errorMessage</div>
<h1 id="logintxt" style="background-color: rgb(11, 146, 9);
background-position: initial;
background-repeat: initial;">Driver Service <b>ß</b>eta</h1>
<div id="submit_giff" style="display: none;">
<hi> Authenticating: <img src="/assets/images/loader-bar.gif" align="absmiddle"> </hi>
</div>
<input id="name" name="userName" placeholder="Username" style="opacity: 1;
background-color: rgb(255, 255, 255);
background-position: initial;
background-repeat: initial;">
<input id="pass" name="password" type="password" placeholder="Password" style="opacity: 1;
background-color: rgb(255, 255, 255);
background-position: initial;
background-repeat: initial;">
<p id="namealert" style="display: none;
opacity: 1;">Username:</p>
<p id="passal" style="display: none;
opacity: 1;">Password:</p>
<input id="loginbtn" style="opacity: 0.2;
cursor: default;" type="submit" value="Login">
</form>
</div>
<script src="/assets/javascripts/login.js"></script>
}
}
Two immediate observations.
One: #helper.form(...) will write a <form> element into the HTML that ultimately gets generated. Your view then includes other literal <form>s nested inside the first form. Nested forms are invalid HTML. You have one form submitting to routes.ApplicationController.doLogin and the other submitting to routes.ApplicationController.login. Who knows which of these the browser will actually submit to? We can't really predict because nested forms are invalid.
Two: you have your #main(...) view nested inside your #helper.form(...). I assume your main view contains <html>...</html>. This is going to result in HTML that starts with a <form> element, inside which is the <html> element. This is horribly invalid markup too.
My guess is one or both of these issues are your problem.
Try taking your generated HTML and running it through an HTML validator like https://validator.nu/. Fix any issues the validator finds, don't nest forms, and decide which (single) route the login form should actually submit to.

play a youtube video with a form

I am trying to play a youtube video that a user enters into a form. Specifically a user will paste a youtube video URL into my form, hit submit, and on the next page it will play that video in an iFrame. Does anyone have any idea how to do this? Somehow it needs to convert the YouTube URL (https://www.youtube.com/watch?v=VIDEO_ID) to the embed URL (http://www.youtube.com/v/VIDEO_ID) and then make that the source of the iFrame on the next page. Thanks in advance for your help!
Try this:
<?php
if(isset($_POST["youtube"]))
{
if(strlen($_POST["youtube"]) == 11)
{
$videoid= $_POST["youtube"];
echo <<< EOF
<iframe frameBorder="no" width="100%" height="100%" src="http://www.youtube.com/embed/$videoid" allowfullscreen></iframe>
EOF;
}else{
$yturl = rawurldecode($_POST["youtube"]);
parse_str( parse_url( $yturl, PHP_URL_QUERY ), $yt_array_of_vars );
$videoid= $yt_array_of_vars['v'];
echo <<< EOF
<iframe frameBorder="no" width="100%" height="100%" src="http://www.youtube.com/embed/$videoid" allowfullscreen></iframe>
EOF;
}
}else{
$posturl = htmlspecialchars($_SERVER["PHP_SELF"]);
echo <<< EOF
<html>
<head>
<style>
html,body, div, iframe{
height: 100%;
overflow: hidden;
overflow-x: hidden;
overflow-y: hidden;
margin: 0; padding: 0;
}
</style>
</head>
<body>
<form method="post" action="$posturl">
<div align="center">
<p> <h3> Type the Youtube URL or VIDEOID</h3></p>
<input type="text" name="youtube" value="">
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>
EOF;
}
?>
Check the YouTube iframe options here
If you want the html5 player, append html5=1to the iframe src, like this:
<iframe frameBorder="no" width="100%" height="100%" src="http://www.youtube.com/embed/$videoid?html5=1" allowfullscreen></iframe>

Multiple jQuery Pop-up Forms: Connect a href to <form> divs for user input

I'm working on a digital textbook feature that would allow the student to click a link to open up a simple div form for them to input their answer to that specific question. The pop-up form is just simple HTML/CSS with some jQuery UI to hide, show, and make it draggable. Here's the twist. I've got multiple questions that each need to be attached to a unique div. No problem, I thought. I'll just set each a href to link back to a unique ID that I've assigned within the DIV. Problem is, I can't seem to target the proper DIV with its corresponding a href. Instead the same set of questions appear no matter which link is clicked. This seems super simple and I'm probably overcomplicating it. What can I do here?
HTML:
<div id="draggable" class="messagepop pop">
<form method="post" id="new_message" action="/answers">
<p><label for="body">What type of person is Carsten?</label><textarea rows="15" name="body" id="body" cols="55"></textarea></p>
<p><label for="body">How do you know?</label><textarea rows="15" name="body" id="body" cols="55"></textarea></p>
<p><center><input type="submit" value="Submit" name="commit" id="message_submit"/> or <a id="hide" href="#">Cancel</a></center></p>
</form>
</div>
<div id="draggable" class="messagepop pop">
<form method="post" id="new_message" action="/answers">
<p><label for="body">What can you learn about an active volcano from the photograph?</label><textarea rows="15" name="body" id="body" cols="55"></textarea></p>
<p><center><input type="submit" value="Submit" name="commit" id="message_submit"/> or <a id="hide" href="#">Cancel</a></center></p>
</form>
</div>
Draw Conclusions What kind of person is Carsten? How do you know?
Use Text Features What can you learn about an active volcano from the photograph?
Where the first a href needs to open the first div and the second a href opens the second div, etc., etc.
CSS:
.messagepop {
overflow-y: auto;
overflow-x: hidden;
cursor:default;
display:none;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
text-align:left;
width:394px;
height: 335px;
z-index:50;
padding: 25px 25px 20px;
background-color: #fff;
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
-moz-border-radius: 4px 4px 4px 4px;
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
-webkit-border-radius: 4px 4px 4px 4px;
border-color: #E5E5E5 #DBDBDB #D2D2D2;
border-style: solid;
border-width: 1px;}
JS:
$(document).ready(function() {
$('.show').click(function() {
if ( !$(this).next('div').is(':visible') ) {
$(".messagepop").slideFadeToggle();
$(this).next('div').slideFadeToggle();
}
});
$('.hide').click(function() {
$(this).parent().slideFadeToggle();});
$.fn.slideFadeToggle = function(easing, callback) {
return this.animate({ opacity: 'toggle', height: 'toggle' }, "fast", easing, callback);};
$(function() {
$("#draggable").draggable();});
Thank you for your advice and for ironing out my poorly written method. It seems you've got it working.
I've since discovered a jQuery Mobile solution that is much easier than what I was trying to pull together.
For future viewers, it would simply look like this.
Draw Conclusions
Use Text Features
<div data-role="popup" id="popup1" class="ui-content" data-position-to="window">
Close
<p>What kind of person is Carsten?</p>
<input type="text"/>
<p>How do you know?</p>
<textarea></textarea>
</div>
<div data-role="popup" id="popup2" class="ui-content" data-position-to="window">
Close
<p>What can you learn about an active <mark><b>volcano</b></mark> from the photograph?</p>
<textarea></textarea>
</div>
The logic here makes a lot more sense to me and there's the added benefit of ensuring it will work properly on mobile devices. Then if you want to make it draggable, just drop in:
<script>
$(function() {
$(".ui-content").draggable();
});
</script>
And then if you want it to be draggable on mobile (remember, jQuery UI isn't natively supported on mobile), you'll have to call up a hack of sorts. I like Touch Punch.
You may run into issues with form inputs when using Draggable combined with Touch Punch, but that's a story for another thread.
Here is a demo: http://jsfiddle.net/ebNsz/
I've set id:s for the question-div:s and target them with the 'href' attribute in the 'a' elements. Not sure what you wanted to do with the 'slideFadeToggle' function, so i used 'fadeToggle' instead.
HTML:
<div id="q1" class="messagepop">
<form method="" id="form1" action="/answers">
<label for="answer1">What type of person is Carsten?</label><textarea name="answer1" class="answer"></textarea>
<label for="answer2">How do you know?</label><textarea name="answer2" class="answer"></textarea>
<div>
<input type="submit" value="Submit" name="submit" /> or <a class="close" href="">Cancel</a>
</div>
</form>
</div>
<div id="q2" class="messagepop">
<form method="" id="form2" action="/answers">
<label for="answer1">What can you learn about an active volcano from the photograph?</label><textarea name="answer1" class="answer"></textarea>
<div>
<input type="submit" value="Submit" name="submit" /> or <a class="close" href="">Cancel</a>
</div>
</form>
</div>
<p>Draw Conclusions What kind of person is Carsten? How do you know?</p>
<p>Use Text Features What can you learn about an active volcano from the photograph?</p>
jQuery: (jsFiddle doesn't support .draggable(), so i commented out the first line and added the second.)
$(function() {
/* $("div.messagepop").draggable().hide();*/
$("div.messagepop").hide();
$("a.toggle").click(function(e)
{
e.preventDefault();
var targetpop = $(this).attr('href');
$(targetpop).siblings("div.messagepop").fadeOut();
$(targetpop).fadeToggle();
});
$("a.close").click(function(e)
{
e.preventDefault();
$(this).closest("div.messagepop").fadeToggle();
});
});
CSS:
.messagepop {
position: absolute;
top: 20%;
left: 50%;
z-index: 50;
margin-left: -197px;
text-align: center;
width: 394px;
height: 335px;
padding: 25px 25px 20px;
background-color: #fff;
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
border-color: #E5E5E5 #DBDBDB #D2D2D2;
border-style: solid;
border-width: 1px;
}
label {
display: block;
}
textarea {
width: 75%;
height: 5em;
margin: 0 0 1em 0;
}