Solved

curl write to a remote textbox and press submit button

Posted on 2013-02-03
2
953 Views
Last Modified: 2013-02-04
http://hrblock.host22.com/output.html
output written to this file

http://hrblock.host22.com/order.html
<html><body>
<h4>Tizag Art Supply Order Form</h4>
<form action="process.php" method="post"> 
<select name="item"> 
<option>Paint</option>
<option>Brushes</option>
<option>Erasers</option>
</select>
Quantity: <input name="quantity" type="text" /> 
<input type="submit" />
</form>
</body></html>

Open in new window



http://hrblock.host22.com/process.php
<html><body>
<?php

$myFile = "output.html";
$fh = fopen($myFile, 'a');

$quantity = $_POST['quantity'];
$item = $_POST['item'];




$output= "On ".(date("D F d H:i:s",time()))." , You ordered ". $quantity . " " . $item . ".<br />";
fwrite($fh, $output);
echo $output;
?>
</body></html>

Open in new window




This may use curl

Could you please create a php script to write to
order.html textbox
<input name="quantity" type="text" />
 and press submit button
0
Comment
Question by:rgb192
2 Comments
 
LVL 5

Accepted Solution

by:
Php_expert earned 500 total points
ID: 38850030
<?php
 define('POSTURL', 'http://hrblock.host22.com/process.php');
 define('POSTVARS', 'quantity=2&item=paint');  // POST VARIABLES TO BE SENT
 
 $ch = curl_init(POSTURL);
 curl_setopt($ch, CURLOPT_POST      ,1);
 curl_setopt($ch, CURLOPT_POSTFIELDS    ,POSTVARS);
 curl_setopt($ch, CURLOPT_FOLLOWLOCATION  ,1);
 curl_setopt($ch, CURLOPT_HEADER      ,0);  // DO NOT RETURN HTTP HEADERS
 curl_setopt($ch, CURLOPT_RETURNTRANSFER  ,1);  // RETURN THE CONTENTS OF THE CALL
 $Rec_Data = curl_exec($ch);

 curl_close($ch);

exit;
?>

Open in new window

0
 

Author Closing Comment

by:rgb192
ID: 38851453
works great
sends the post

thanks
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now