[rt-users] any ideas why this post with php CURL not setting custom field?

vtplymblfan-rt at yahoo.com vtplymblfan-rt at yahoo.com
Tue May 19 12:53:21 EDT 2009


Hi there,

I have modified a web application to post to RT's web interface a create ticket request. The post works perfectly... the ticket get created in the right queue with the given subject and text... except that the custom field value I pass (UPC) in does not get set. Here is the CURL code:

----

    $content = 'id: new
CF-UPC: 786936180992
Text: This is the ticket text
Subject: This is the subject
Queue: External App Requests';

    $request = RT_LOCATION;
    $request .= 'ticket/new/';

    $postargs = array(
       'user' => RT_USER,
       'pass' => RT_PASS,
       'content' => $content
    );

    // get the curl session object
    $session = curl_init($request);

    // set the POST options
    curl_setopt ($session, CURLOPT_POST, true);
    curl_setopt ($session, CURLOPT_POSTFIELDS, $postargs);
    curl_setopt($session, CURLOPT_HEADER, true);
    curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
    curl_setopt( $session, CURLOPT_HTTPHEADER, array( 'Expect:' ) );

    // do the POST and then close the session
    $response = curl_exec($session);
    curl_close($session);

---

In debugging this I have also created a simple form which posts to the same place:


<form method="POST"action="http://foo.foo.edu/REST/1.0/ticket/new/">
User: <input type="text" name="user" size="20"><br>
Pass: <input type="text" name="pass" size="20"><br>
Content: <textarea rows="10" name="content" cols="30">id: new
CF-UPC: 786936180992
Text: This is the ticket text from the form.
Subject: This is the subject
Queue: External App Requests</textarea><br>
<p><input type="submit" value="Submit" name="B1">
</form> 

When this form is used, again the ticket is created but in this case the custom field UPC does get set. But 
the "Content:" being sent is the same in both. In particular in both cases I am providing UPC's value with 
"CF-UPC: 78..." Can anyone here explain what the difference could possibly be between these two
posting methods that could result in this scenario? By the way, in both cases I am passing in the same 
user name and password. I am really stumped and I suspect some small stupid thing I have missed.

Thanks for your help,
Kim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090519/d99411dd/attachment.htm>


More information about the rt-users mailing list