?
Solved

curl write to a remote textbox and press submit button

Posted on 2013-02-03
2
Medium Priority
?
1,067 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
Php_expert earned 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

770 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