我想发送一个URL重定向到请求页面的发布请求。 Jest认为请求页面当前用于处理提交表单。使用Zend_Http_Client发送邮件请求
我试过以下代码到我的请求页面。
<?php
$myFile = "test.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "Request come to the page\n";
fwrite($fh, $stringData);
if (isset($_POST)) {
$stringData = $_POST['user'];
fwrite($fh, $stringData);
}
fclose($fh);
echo 'page found';
我试过Zend_Http_Client
这样做。这是我的简单行动。
public function indexAction()
{
$client = new Zend_Http_Client('http://localhost/test/test.php');
$client->setParameterPost(array('user' => 'dinuka'));
$client->setConfig(array('strictredirects' => true));
$response = $client->request(Zend_Http_Client::POST);
}
现在请求发送到test.php。但不能重定向到http://localhost/test/test.php
页面。我想发送请求+重定向。我之前曾问过这个问题。但它是纯粹的问题。请帮帮我。我没有很好的关于http请求的知识。什么是strictredirects
?
你能否澄清你的问题? “通过网址重定向发送请求页面的发布请求”是什么意思? – Liyali 2012-02-21 13:33:10
@Liyali - 当您提交表单时,发送参数以形成动作URL并重定向到该URL。我也想这样做,但是没有形式。 – 2012-02-22 04:20:09
如果您始终想将您的操作重定向到/test/test.php,那么为什么不使用重定向器来做呢? – Liyali 2012-02-22 04:35:15