I do have an html form that accepts textbox input of sha1 hashes per line:
<textarea id="mid "name="mid" cols="40" rows="5"></textarea>
Example values are:
9a3845cf0aac825d4e754610baa473f53636f10a
9a3845cf0aac825d4e754610baa473f53636f10b
9a3845cf0aac825d4e754610baa473f53636f10c
My problem is I need to take each value from the textbox "per line" and pass it to curl, my code below works only on a single entry basis:
<?php
$pf="pf";
$ur="ur";
$pw="pw";
$url="url.com";
extract($_POST);
$mid=$_POST['mid'];
$fields = array(
'user'=>urlencode($ur),
'pass'=>urlencode($pw),
'pfid'=>urlencode($pf),
'msid'=>urlencode($mid)
);
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
$result=curl_exec($ch);
curl_close($ch);
?>
My expected output from the curl'ed server are the results of all those from the textbox:
9a3845cf0aac825d4e754610baa473f53636f10a - okay
9a3845cf0aac825d4e754610baa473f53636f10b - cancelled
9a3845cf0aac825d4e754610baa473f53636f10c - okay
Any thoughts? Thanks in advance!