Edit report at http://pear.php.net/bugs/bug.php?id=18754&edit=1
ID: 18754
Updated by: [email protected]
Reported By: misc at vosys dot com dot br
Summary: Emulating POST
-Status: Open
+Status: Bogus
Type: Bug
Package: HTTP_Request2
Operating System: Windows Vista
Package Version: 2.0.0RC1
PHP Version: 5.2.4
Roadmap Versions:
New Comment:
-Status: Open
+Status: Bogus
This is not a support forum. Write to pear-general mailing list for
support.
Previous Comments:
------------------------------------------------------------------------
[2011-08-24 03:03:27] vosys
Description:
------------
Why this POST returns an empty body?
Accessing through the browser and typing the values, at
http://200.252.60.80/encomendas/prazo/default.cfm, works
well.
I added all input fields needs on POST via
addPostParameter():
FieldName Value
---------------- ---------------
resposta........: paginaCorreios
servico.........: 40010 (Sedex 10)
cepOrigem.......: 01152-000
cepDestino......: 72125-530
peso............: 1
Comprimento.....: 20
Largura.........: 20
Altura..........: 20
Formato.........: 1
valorD..........: 0
valorDeclarado..: 10,51
Diametro........: 0
MaoPropria......: N
avisoRecebimento: N
embalagem.......: 116600403
data............: 23/08/2011 (Data de Postagem)
dataAtual.......: 23/08/2011 (Data de Postagem)
Test script:
---------------
try {
$r = new
HTTP_Request2('http://200.252.60.80/encomendas/prazo/default.cfm');
$response = $r->send();
foreach ($response->getCookies() as $arCookie){
$r->addCookie($arCookie['name'], $arCookie['value']);
}
$r->setMethod(HTTP_Request2::METHOD_POST)->setHeader('Content-type:text/xml;
charset=iso-8859-1')->addPostParameter(array('resposta'=>'paginaCorreios',
'servico'=>'40010', 'cepOrigem'=>'01152-000', 'cepDestino'=>'72125-530',
'peso'=>'1', 'Comprimento'=>'20', 'Largura'=>'20', 'Altura'=>'20',
'Formato'=>'1', 'valorD'=>'0', 'valorDeclarado'=>'10,51',
'Diametro'=>'0', 'MaoPropria'=>'N', 'avisoRecebimento'=>'N',
'embalagem'=>'116600403', 'data'=>'23/08/2011',
'dataAtual'=>'23/08/2011'));
$r->setUrl('http://200.252.60.80/encomendas/prazo/prazo.cfm');
echo $r->send()->getBody();
} catch (HttpException $ex) {
echo $ex;
}
Expected result:
----------------
I want to see the result page
http://200.252.60.80/encomendas/prazo/prazo.cfm with HTML
expected information, not a redirection (status 302).
Actual result:
--------------
HTTP redirection with status 302.
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=18754&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.