2012-07-20 128 views
0

在我的API訪問文件,我有以下代碼在查詢字符串調整變量

//operation was successful get the token from the reponse. 
$challengeToken = $r->result->token; 
    // to this point, we have got the token 

$userAccessKey = 'jkdijakjiejkdj25';  
//generate key 
$generatedKey = md5($challengeToken.$userAccessKey); 

,我使用http_request2類發送POST數據,通過聲明

$loginrequest = new HTTP_Request2('http://vijayholdings.com/admin/webservice.php?operation=login&username=admin&accessKey=('.$generatedKey.')', HTTP_Request2::METHOD_POST); 

有人可以告訴我如何我可以在URL中包含$ generatedKey作爲參數給類的參數?

FOR NOW

$loginrequest = new HTTP_Request2('http://vijayholdings.com/admin/webservice.php?operation=login&username=admin&accessKey=$generatedKey', HTTP_Request2::METHOD_POST); 

我有太多想這一點,但在失敗...

請指引我

回答

0

只需使用雙引號" "解析器皮卡"$variables"

+0

'http://vijayholdings.com/admin/webservice.php?operation=login&username=admin&accessKey="$generatedKey「' 我已經試過這一點,但沒有成功 – 2012-07-20 23:12:37

+0

沒有,'$ loginrequest =新HTTP_Request2(」 http://vijayholdings.com/admin/webservice.php?operation=login&username=admin&accessKey=$generatedKey「,HTTP_Request2 :: METHOD_POST);' – Martin 2012-07-20 23:14:14

+0

儘管變量在記事本++中獲得了不同的顏色,但仍然不起作用 – 2012-07-20 23:20:10