2012-07-20 90 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