Issues with API

techbits's Avatar


09 Aug, 2007 03:17 PM


I was wondering if someone could help. I'm trying to use PHP to add a new ticket, however I just keep getting <nil-classes type="array"/>. Here's my code...

$toLog .= 'Date: '.date('r')."\n\n"; $toLog .= 'URL: '.$SERVER["HTTP_HOST"].$SERVER["REQUEST_URI"]."\n\n"; $toLog .= $errorMsg."\n";

// Send to lighthouse $base = '{project#}/tickets.xml';

$params = array('_token' => 'abc123', 'body' => $toLog, 'state' => 'new', 'title' => 'Error from website' );

foreach ($params as $key => $value) { $query_string .= "$key=" . urlencode($value) . "&"; }

$url = "$base?$query_string";

$c = curl_init($url); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); $xml = curl_exec($c); curl_close($c); echo $xml;

Any thoughts/help would be VERY appreciated.

  1. 1 Posted by Rick on 09 Aug, 2007 03:55 PM

    Rick's Avatar

    You need to post XML to the API for this to work. Something like:

      blah blah
      blah blah

    Perhaps you could use something like simplexml to come up with a php equivalent to ActiveResource?

Discussions are closed to public comments.
If you need help with Lighthouse please start a new discussion.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac