0

So I'm trying to send a POST request with pear HTTP_Request_2

I'm adding a POST parameter to a request with addPostParameter function

$request->addPostParameter(array(
         'lgname'=>'Admin',
         'lgpassword'=>'xxx','lgtoken'=>$xmlresponse->login['token']
                        ));

however some extra characters appear in POST request body:

lgname=Admin&lgpassword=xxx&lgtoken%5B0%5D=6b9c078a99d5e9821ccaa8b3d41bfdef

uri decode says that %5B0%5D is [0] so it looks like lgtoken[0]=6b9c078a99d5e9821ccaa8b3d41bfdef

, but how does this appear here?? How to get rid of it?\

I need just lgtoken=6b9c078a99d5e9821ccaa8b3d41bfdef

bravik
  • 433
  • 7
  • 17
  • 1
    Maybe $xmlresponse->login['token'] returns an array with just one value and addPostParameter checks if a param has an array assigned. In this case it would generate an array for this param like in your example. Could you just verify/var_dump the content of $xmlresponse->login['token']? – TRD Jul 24 '12 at 07:13
  • thank you for response. here is vardump: class SimpleXMLElement#37 (1) { string(32) "7894940ac800b8c1142b83cb176758ca" }. – bravik Jul 26 '12 at 02:59
  • You were right.. I tried (string) $xmlresponse->login['token']; and it worked.. Thank you for a hint.. – bravik Jul 26 '12 at 03:04

0 Answers0