[rt-devel] cmd line ticket creation

Dale Bewley dale at bewley.net
Mon Apr 23 14:17:48 EDT 2001


well, if anyone was mildly curious what I did, this is the basic php code
I used to make the ticket and get back the ticket number. It can use some
error handling and needs to formatting for the ticket body done.

function make_ticket() {
        $body ="From: test at test
To: RT
Subject: testing

This is a test.
";
        $filename = tempnam("/tmp","tick");
        $outfh=popen("/opt/rt/bin/rt-mailgate --extended-syntax -a 
correspond -t -q todo 2>&1 > $filename","w");
        fwrite($outfh,$body);
        fflush($outfh);
        pclose($outfh);
        $infh = fopen("$filename","r");
        $ticket_number = fread($infh,256);
        $ticket_number = str_replace("\n","",$ticket_number);
        fclose($infh); 
        unlink($filename); 
        return $ticket_number;
}


--
Dale Bewley - Bewley Internet Solutions Inc. http://bewley.net/





More information about the Rt-devel mailing list