Starting point for php API?

Discussion and information for XML-RPC interface.

Moderators: Amaradana, TurboPT, TL Developers

Post Reply
tfeathers
Advanced user
Posts: 19
Joined: Thu Mar 19, 2009 1:19 pm

Starting point for php API?

Post by tfeathers »

I need a doc to walk me through how to even start getting the API to work. I still can't find the sample client code... Anyone that can help me?
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Post by fman »

have you browsing your TL installation?
see inside lib\api\ folder
tfeathers
Advanced user
Posts: 19
Joined: Thu Mar 19, 2009 1:19 pm

Post by tfeathers »

Thank you very much. Now I have a question about the php scripts? When I run them from command line on my location machine. I get IXR_Client not found. Am I missing something on my php install? Should these script be run on the server where testlink is installed?
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Post by fman »

you need to have part of TL installation i.e. XML-RPC library
tfeathers
Advanced user
Posts: 19
Joined: Thu Mar 19, 2009 1:19 pm

Post by tfeathers »

Isn't that taken care of by the require statement?
require_once dirname(__FILE__) . THIRD_PARTY_CODE . '/xml-rpc/class-IXR.php';
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Post by fman »

yes but you have to have this ON HOST from where you are trying to run client
tfeathers
Advanced user
Posts: 19
Joined: Thu Mar 19, 2009 1:19 pm

Post by tfeathers »

Thank you very much. It is all working now. Is there a way for me to use php -a <scriptname>.php to only print out the data I need to the command line?

For example,

$args["testplanid"]='7';
$args["testcaseexternalid"]='Test-2';

$debug=true;
echo $unitTestDescription;
$client = new IXR_Client($server_url);
$client->debug=$debug;

new dBug($args);
if(!$client->query("tl.{$method}", $args))
{
echo "something went wrong - " . $client->getErrorCode() . " - " . $client->getErrorMessage();
$response=null;
}
else
{
$response=$client->getResponse();
}

I want to parse $response as a string and get the date I need. Not print it out using new dBug($response);
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Post by fman »

comment out dBug() calls
in anyway examples are thinked to be runned NOT FROM COMMAND LINE
and I've never tested it in this condition
Post Reply