I want to run cgi in wamp. I followed the instructions in this link
http://www.chromicdesign.com/2009/05/setting-up-perl-for-wampp.html
Here is my html code
<HTML>
<BODY>
<FORM METHOD="POST" ACTION="./cgi-bin/myscript.cgi">
<PRE>
First Name <INPUT TYPE="text" NAME="fname" MAXLENGTH=15 SIZE=15>
Last Name <INPUT TYPE="text" NAME="lname" MAXLENGTH=20 SIZE=20>
E-Mail Addr <INPUT TYPE="text" NAME="email" MAXLENGTH=35 SIZE=35>
<INPUT TYPE="submit" VALUE="Send Mail!">
<INPUT TYPE="reset" value=" Clear-Form">
</PRE>
</FORM>
</BODY>
</HTML>
And my CGI script
#!/usr/bin/perl
read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
#pairs=split(/&/,$temp);
foreach $item(#pairs)
{
($key,$content)=split(/=/,$item,2);
$content=~tr/+/ /;
$content=~s/%(..)/pack("c",hex($1))/ge;
$fields{$key}=$content;
}
print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<BODY BGCOLOR=#FFFFFF>\n";
print "<CENTER>\n";
print "THANK YOU<BR>\n";
print "$fields{fname} $fields{lname}</BR>";
print "I will write<BR>\n";
print "you at<BR>\n";
print "$fields{email}<BR>\n";
print "</CENTER>\n";
print "</BODY></HTML>";
Whenever i run it gives INERNAL SERVER ERROR. I don't know what to do.
Please help me out
to understand what happened you should look into Apache error log. But here the problem is most probably that the shebang line in your script does not look at the actual perl installation
Related
Here is the HTML code
<form method="POST" action="https://testnet.demo.example.org/api/v1/invoices">
<input type="hidden" name="storeId" value="LLKZz9dtP7DYvEUDq73K59EKvjMWox7nvnUhfCGMKsux" />
<input type="hidden" name="price" value="10" />
<input type="hidden" name="currency" value="USD" />
<input type="image" class="submit" name="submit">
</form>
When I click the "submit" button, it redirects me to a random url like this,
https://testnet.demo.example.org/invoice?id=KuVFG7YFmfArccjkmBPhyg
How can I send this POST request using command line using cURL and get that random invoice url?
Here is the command:
curl --verbose --request "POST" "https://testnet.demo.example.org/api/v1/invoices?storeId=LLKZz9dtP7DYvEUDq73K59EKvjMWox7nvnUhfCGMKsux&price=10¤cy=USD"
You can always use tools like this curl-builder, but I highly suggest to use tools like Postman to make api calls.
I am facing this error. The path of my file is "www/new/filename.html". What is the cause of error. Is the error is because of wrong code or due to configuration issue? I am trying to print the details of form on same file but i am getting error.
<html>
<body>
<?php
$name="";
$ne="";
if($_SERVER["$_REQUEST_METHOD"]=="POST")
{
$name=$_POST["nam"];
if(empty($name))
{
$ne="Error"
}
}
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Name: <input type="text" name="nam"><?php echo $ne;?>
Gender<input type="radio" name="gen" value="male">Male
<input type="radio" name="gen" value="female">female
<input type="submit" name="submit" value="Submit">
</form>
<?php
echo "<h1> Inputs </h1>";
echo "$name";
?>
</body>
</html>
Issue a sestatus to check if you have selinux enabled or not. Check web server logs as well to see if you get more details about the forbidden error
I have a form on the only page within a directory that is password protected via cPanel. Such as...
www.site.com/directory/subdirectory/form.php
Once every twenty submits of the form (in the same session) I am redirected to:
www.site.com
and obviously the php form processing doesn't occur.
WHAT IS HAPPENING?
I have checked my redirects in cpanel and none are set. So I don-t even know why it goes to the index page!
NOTES
No question on SO mentions this problem and I have found nothing suitable in google. I'm not sure what the problem is so it's hard to 'google'.
Here is the form.php format
<?php
header('Content-Type: text/html; charset=utf-8');
session_start();
require 'functions.php';
connect();
/*“Æ” because UTF-8 encoding without BOM looks like ANSI*/
if(isset($_POST['newJob'])){
$jTDjobToDo = $_POST['jobToDo'];
$jTDwhenInfo = $_POST['whenInfo'];
$jTDwhenInfo = $jTDwhenInfo+ time();
$jTDinsertNewJob = $conn ->prepare ("INSERT INTO jobstodo (jobToDo,whenInfo) VALUES(:jobToDo,:whenInfo)");
$jTDinsertNewJob->bindParam(':jobToDo', $jTDjobToDo, PDO::PARAM_STR);
$jTDinsertNewJob->bindParam(':whenInfo', $jTDwhenInfo, PDO::PARAM_INT);
$jTDinsertNewJob->execute();
echo "New job added!<br/>";
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>My page</title>
<LINK href="stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="newjobform">
ADD A NEW JOB
<form action="http://www.site.com/myPage.php" method="POST">
New Job To Do <input type="text" name="jobToDo" id="newJobToDo" ><br/>
When to do<br/>
<input type="radio" name="whenInfo" value="0" CHECKED>Now /
<input type="radio" name="whenInfo" value="86400"> 1 day
/ <input type="radio" name="whenInfo" value="172800"> 2 days
/ <input type="radio" name="whenInfo" value="345600">4 days<br/>
<input type="radio" name="whenInfo" value="604800">7 days
/ <input type="radio" name="whenInfo" value="1209600">14 days
/ <input type="radio" name="whenInfo" value="2073600">24 days
/ <input type="radio" name="whenInfo" value="3888000">45 days<br/>
<input type="submit" value="ADD" name="newJob"><br/>
</form>
</div>
</body>
</html>
The function php connects as so..
try {
$conn = new PDO("mysql:host=$hostdb; dbname=$namedb", $userdb, $passdb);
//echo 'Connected to database';
}
catch(PDOException $e) {
echo $e->getMessage();
}
}
Well i have this search engine into my site
<form action="/apps/search/" name="g_search" id="cse-search-box" method="post">
<input type="hidden" name="cof" value="FORID:11;NB:1" />
<input type="hidden" name="ie" value="utf-8" />
<input type="text" autocomplete="off" name="google_seach" class="search-text" onfocus="searchtext('focus')" onblur="searchtext('blur')" />
<label style="color:#796b6b;float:left;padding:0;">|</label>
<input type="submit" style="float:right;margin-top:3px;cursor:pointer;width:16px;height:16px;background:url(/template/img/main/search-icon.jpg);border:none;" value="" alt="Αναζήτηση" title="Αναζήτηση" />
</form>
Now i want some code to results page.Somehow the post request readed from a file called search.php
This file have access to $_POST[] array..
The file initializes $selector variable (for template use).
What we want to echo into contentarea div must put into $body variable..
Any help?
<?php
$selector="search";
$body="<div id=\"cse-search-form\" style=\"width: 100%;\">Loading</div>";
?>
I have a similar issue, just use GCS code provide by Google as it easy, make sure in the option in GSE you select to visualize the search result on your page and not an Iframe
HI im trying to integrate zoho into my website and open a document in browser
Im using Wamp server.
This the code im trying to work with:
<html>
<head>
</head>
<body>
<form method="POST" action="http(s)://export.writer.zoho.com/remotedoc.im" target="_self"
accept-charset="UTF-8">
<input type="hidden" name="url" value="http://localhost/paper.doc">
<input type="hidden" name="apikey" value="here goes api key">
<input type="hidden" name="output" value="url">
<input type="hidden" name="mode" value="normaledit">
<input type="hidden" name="filename" value="paper.doc">
<input type="hidden" name="lang" value="en">
<input type="hidden" name="skey" value="here goes secret value">
<input type="hidden" name="id" value="12345678">
<input type="hidden" name="format" value="doc">
<input type="hidden" name="saveurl" value="http://localhost/save.php">
<input type="submit" name="submit" value="Open/Edit">
</form>
</body>
</html>
I dont know i get this error:
Forbidden
You don't have permission to access /http(s)://export.writer.zoho.com/remotedoc.im on this server.
I have entered the api key correctly and the secret key
Im just confused and stuck here.Im blocked
Here is the documentation : http://apihelp.wiki.zoho.com/Open-Document.html
You have taken the (s) out of the url right? I know it might seem like a silly question but I thought I should check in case you had overlooked it. The url resolves for me and gives an 'api key is invalid' warning.
The error given would seem to indicate the browser thinks its a relative instead of absolute url.
I dont know much more about ZOHO but i also want to implement this in my project in future. As i read in https://apihelp.wiki.zoho.com/Open-Document.html#mfs it says that saveurl must be publicly accessible and if it not accessible publicly it gives an error and localhost is not publicly accessible so it gives an error.