【发布时间】:2011-02-24 20:54:33
【问题描述】:
我正在使用 PHP 的 HTTPRequest 调用 web 服务,代码如下:
<?php
$req = new HTTPRequest
('http://webrates.truefx.com/rates/connect.html?u=user&p=pass&f=html&q=dfrates');
echo $req->getResponseBody();
?>
我在浏览此链接时收到 HTTPResponse:
user:pass:dfrates:1298580682944
注意最后一个冒号后面的会话 ID。
首先,我是否正确使用了 HTTPRequest?我应该发送到另一个变量,而不是回显响应?
其次,我需要在第一个响应中引用会话 ID 的后续 HTTPRequest。如何从响应中子串该会话 ID 并在后续请求中使用它?
非常感谢您的帮助和指导。
【问题讨论】:
标签: php httprequest httpresponse