+ add signature verification.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/* 包含http客户端类,snoopy。在禅道lib/snoopy里面可以找到。*/
|
||||
include '../lib/snoopy/snoopy.class.php';
|
||||
include dirname(dirname(__FILE__)) . '/lib/snoopy/snoopy.class.php';
|
||||
|
||||
/* 用来登录的地址,用户名和密码。*/
|
||||
$zentaoRoot = "http://demo.zentaoms.com/"; // 请根据实际的情况进行修改。
|
||||
@@ -31,30 +31,44 @@ elseif($requestType == 'PATH_INFO')
|
||||
$snoopy = new Snoopy;
|
||||
$snoopy->fetch($sessionAPI);
|
||||
$session = json_decode($snoopy->results);
|
||||
$session = json_decode($session->data);
|
||||
|
||||
/*用户登录*/
|
||||
$authHash = md5(md5($password) . $session->rand);
|
||||
$submitVars["account"] = $account;
|
||||
$submitVars["password"] = $password;
|
||||
$submitVars["password"] = $authHash;
|
||||
$snoopy->cookies[$session->sessionName] = $session->sessionID;
|
||||
$snoopy->submit($loginAPI, $submitVars);
|
||||
|
||||
/* 直接调用my模块的bugs页面。*/
|
||||
$snoopy->fetch($myBugAPI . "&$session->sessionName=$session->sessionID");
|
||||
$result = json_decode($snoopy->results);
|
||||
if($result->bugs)
|
||||
|
||||
if($result->status == 'success' && md5($result->data) == $result->md5)
|
||||
{
|
||||
foreach($result->bugs as $bug) echo $bug->title . "\n";
|
||||
$bugs = json_decode($result->data)->bugs;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "called failed or transfered not complete.";
|
||||
exit;
|
||||
}
|
||||
|
||||
if($bugs)
|
||||
{
|
||||
foreach($bugs as $bug) echo $bug->id . "\t" . $bug->title . "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'no bugs' . "\n";
|
||||
}
|
||||
|
||||
/* 通过超级model调用。*/
|
||||
$snoopy->fetch($superMyBugAPI . "&$session->sessionName=$session->sessionID");
|
||||
$result = json_decode($snoopy->results);
|
||||
if(is_array($result))
|
||||
if(is_object($result))
|
||||
{
|
||||
foreach($results as $bug) echo $bug->title . "\n";
|
||||
foreach($result as $id=>$bug) echo $id . "\t" . $bug . "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/* 包含http客户端类,snoopy。在禅道lib/snoopy里面可以找到。*/
|
||||
include '../lib/snoopy/snoopy.class.php';
|
||||
include dirname(dirname(__FILE__)) . '/lib/snoopy/snoopy.class.php';
|
||||
|
||||
/* 用来登录的地址,用户名和密码。*/
|
||||
$zentaoRoot = "http://pms.easysoft.com/";
|
||||
|
||||
Reference in New Issue
Block a user