【问题标题】:adjust variable in query string调整查询字符串中的变量
【发布时间】:2012-07-20 23:06:41
【问题描述】:

在我的 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 类发送帖子数据,通过声明

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

谁能告诉我如何在作为参数给类的 URL 中包含 $generatedKey?

暂时

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

我也试过这个,但是失败了……

请指导我

【问题讨论】:

    标签: php oop http variables http-post


    【解决方案1】:

    只需使用双引号 " " 让解析器获取 "$variables"

    【讨论】:

    • 'vijayholdings.com/admin/…"' 我试过这个,但没有成功
    • 不,$loginrequest = new HTTP_Request2("http://vijayholdings.com/admin/webservice.php?operation=login&username=admin&accessKey=$generatedKey", HTTP_Request2::METHOD_POST);
    • 虽然变量在记事本++中得到了不同的颜色,但仍然无法正常工作
    • 它工作正常:codepad.viper-7.com/pGSGRw - 你真的应该阅读 PHP 教程......
    • thanks....那可能还有一些其他的错误,如果你不介意,你能告诉我如何在http_request2方法post中单独添加post参数吗?
    猜你喜欢
    • 2017-04-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-25
    • 1970-01-01
    • 2014-10-18
    • 2013-08-28
    • 1970-01-01
    相关资源
    最近更新 更多