You are here: Re: Question about Request.php « PHP « IT news, forums, messages
Re: Question about Request.php

Posted by James Benson on 09/25/30 11:33

Try checking for the error after:- $Req->sendRequest();

Example:-


$response = $Req->sendRequest();

if (PEAR::isError($response)) {
die($response->getMessage());
}

$Response = $Req->getResponseBody();



You may also want to include some options like so:-


$options = array(
'method' => 'GET',
'http' => '1.1',
'allowRedirects' => true,
'saveBody' => true,
);

$Req = &new
HTTP_Request("http://www.geoportal.com.br/mapapp/avl/xservmapa1.asp",
$options);




James


Danilo Azevedo wrote:
> Hi, my name is Danilo, i am from Brazil
> I need your assistence with a code made by your self, if you are not too
> busy :P
> I am using PHP/XML with your request.php file, but i cant get some
> attributes from a Tag, everything is working fine, but it :(
> The Tag name is "RUA" and have some attributes that i need for my
> application, i am adding all Tags and if i do a echo $Response i cant
> see any attributes.
>
> If you cant help please tell me where can i find some support!! please!! :)
> Thanks for all and sorry for my badly english :D
>
> Danilo
>
> ----------------------------------------------------------
> my request code:
> ...
>
> $Response = '';
> $Req = &new HTTP_Request("
> http://www.geoportal.com.br/mapapp/avl/xservmapa1.asp")<http://www.geoportal.com.br/mapapp/avl/xservmapa1.asp%22%29>
> ;
> $Req->setMethod(HTTP_REQUEST_METHOD_POST);
> $Req->clearPostData();
> $Req->addHeader("Ticket",$HTTP_SESSION_VARS["ticket"]);
> $Req->addPostData('CX', $LongC);
> $Req->addPostData('CY', $LatC);
> $Req->addPostData('Z', $LargM);
> $Req->addPostData('N', 1);
> $Req->addPostData('P1', "MAX");
> $Req->addPostData('X1', $Long);
> $Req->addPostData('Y1', $Lat);
> $Req->addPostData('RT1',$Texto);
> $Req->addPostData('E1', "SXCAR1-32;D30");
> $Req->addPostData('H', $Alt);
> $Req->addPostData('W', $Larg);
> $Req->addPostData('RINFO', 100);
> $Req->addPostData('INFO', "S");
>
> if (empty($Zoom)){
> if (!empty($LongI) || !empty($LatI)){
> $Req->addPostData('XP',$LongI);
> $Req->addPostData('YP',$LatI);
> switch ($TCentr){
> case 1:
> $Req->addPostData('CMD',"C"); break;
> case 2:
> $Req->addPostData('CMD',"C+"); break;
> case 3:
> $Req->addPostData('CMD',"C-"); break;
> default:
> $Req->addPostData('CMD',"C"); break;
> }
> }
> }else{
> $Req->addPostData('XP',round($Larg / 2));
> $Req->addPostData('YP',round($Alt / 2));
> if ($Zoom == 1)
> $Req->addPostData('CMD',"C+");
> elseif ($Zoom == -1)
> $Req->addPostData('CMD',"C-");
> }
> $Req->sendRequest();
> $Response = $Req->getResponseBody();
> ...
>
> ----------------------------------------------
>
> echo $Response dont show the attributes (NroIni, NroFim, Bairro) :(
> here is how the server send a correct XML request, look at the RUA tag:
>
> <?xml version="1.0" encoding="windows-1252" ?>
> <SERVMAPA>
> <LOCALIDADE> // dados sobre a localização do CENTRO DO MAPA
> <CIDADE>nome da cidade</CIDADE>
> <ESTADO>sigla do estado</ESTADO>
> </LOCALIDADE>
> <MAPA>
> <PIC>url do GIF gerado</PIC>
> <CX>longitude do centro do mapa</CX>
> <CY>latitude do centro do mapa</CY>
> <Z>zoom</Z>
> <N>quantidade de pontos</N>
> <PONTO indice=""> // Haverão N itens do tipo PONTO
> <P>identificação do ponto</P>
> <X>longitude</X>
> <Y>latitude</Y>
> <XP>posição do ponto sobre o GIF. Coordenada em
> pixels</XP>
> <YP>posição do ponto sobre o GIF. Coordenada em
> pixels</YP>
> <LOCALIDADE> // dados sobre a localização do PONTO
> <RUA NroIni="" NroFim="" Bairro="">nome da
> cidade</RUA>
> <CIDADE>nome da cidade</CIDADE>
> <ESTADO>sigla do estado</ESTADO>
> </LOCALIDADE>
> </PONTO>
> </MAPA>
> </SERVMAPA>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация