I have built a php script which receives values in $_POST and $_FILES
I m catching those values, and then trying to use CURL to make posts to FogBugz.
I can get text fields to work, but not files.
$request_url = "http://fogbugz.icarusstudios.com/fogbugz/api.php";
$newTicket = array();
$newTicket[ cmd ] = new ;
$newTicket[ token ] = $token;
$newTicket[ sPersonAssignedTo ] = autobugz ;
$text = "
";
foreach( $form as $pair ) {
$text .= $pair[2] . ": " . $pair[0] . "
";
}
$text = htmlentities( $text );
$newTicket[ sEvent ] = $text;
$f = 0;
foreach ($_FILES as $fk => $v) {
if ($_FILES[$fk][ tmp_name ] != ) {
$extension = pathinfo( $_FILES[$fk][ name ], PATHINFO_EXTENSION);
//only take the files we have specified above
if (in_array( array( $fk, $extension ) , $uploads)) {
$newTicket[ File .$f] = $_FILES[$fk][ tmp_name ];
//echo ( $_FILES[$fk][ name ] );
//echo ( $_FILES[$fk][ tmp_name ] );
//print $fk;
//print <br/> ;
//print_r( $v );
}
}
}
$ch = curl_init( $request_url );
$timeout = 5;
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_POSTFIELDS, $newTicket );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);