Discussion Board

Results 1 to 11 of 11
  1. #1
    Super Contributor raj8nokiaforum's Avatar
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    579
    Hello,

    I have two urls. The first one is something like
    Code:
    http://10.10.10.10/page1.php?usr=123&pwd=000
    Respose of this is an inputbox, a button (on browser) and an action url something like
    Code:
    http://11.11.11.11/page2.php
    When the user hits the second link, the value entered in inputbox should along with request. Response to the second url is a
    string response.

    The issue:
    If i am not wrong, the first request would be http GET type and second would be http POST type. I am getting correct response on
    making the first request but second request is not giving the correct response from the server if i do this is code. However if i use the browser manually, the response is correct.
    I also tried encoding the url as well but still not getting the correct response.

    Any pointers to this?

  2. #2
    Super Contributor raj8nokiaforum's Avatar
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    579
    Also i am using the following code to encode the url:

    I am not sure if this encodes in utf-8 format. Do you think this is correct?

    Code:
    HBufC* CWebClient::UrlEncodeL(TDes& aUrl)
    {
      _LIT(KFormatCode, "%%%02x");
      
      if (!aUrl.Length())
      {
         return NULL;
      }
      TBufC<100> sDontEncode = _L("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!-_.()*;/?:@&=+$[]!\\'()~");
    
     // Alloc to the maximum size of URL if every char are encoded
      HBufC *sEncoded = HBufC::NewLC(aUrl.Length() * 3);
    
      // Parse a the chars in the url
      for (TInt i=0; i<aUrl.Length(); i++)
      {
         TChar cToFind = aUrl[i];
         if (KErrNotFound == sDontEncode.Locate(cToFind) )
         {
            // Char not found encode it.
            TUint c = (TUint) cToFind;
            sEncoded->Des().AppendFormat(KFormatCode, c);
         }
         else
         {
            // char found just copy it
            sEncoded->Des().Append(cToFind);
         }
      }
    
      // Reallocate to the real size of the encoded url.
      sEncoded->ReAllocL(sEncoded->Length());
    
      return sEncoded;
    }

  3. #3
    Nokia Developer Champion vineet.jain's Avatar
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,861
    What happens if you make the second request to be GET as well.

  4. #4
    Super Contributor raj8nokiaforum's Avatar
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    579
    But how do i pass the pin number in that case which is entered in the inputbox?

  5. #5
    Super Contributor raj8nokiaforum's Avatar
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    579
    I tried the second url as GET by setting pin: 00000000000000 in headers. The response is still not correct because the request to server is not correct.

  6. #6
    Nokia Developer Champion vineet.jain's Avatar
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,861
    In the same way it is done in first request(http://11.11.11.11/page2.php?boxvalue=1234). When user hits the second url, you can internally append the box value.

  7. #7
    Super Contributor raj8nokiaforum's Avatar
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    579
    No this is incorrect. I tried this as well and the result is same. I am getting the following error message from server alongwith some html

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

  8. #8
    Nokia Developer Champion pooja_1650's Avatar
    Join Date
    Nov 2011
    Location
    India
    Posts
    315
    You can check the request (with headers) in Fiddler for both correct/incorrect cases and compare the difference.

    If i am not wrong, the first request would be http GET type and second would be http POST type.
    Yes, your first request should be GET and second should be POST.

  9. #9
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    27,746
    An addition to the encoding part: you may find the class EscapeUtils useful.

  10. #10
    Super Contributor raj8nokiaforum's Avatar
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    579
    Does anybody know how to identify cookies sent by the server and how to send cookies to the server?

    I found out that cookies can be sent in headers is it? I have to send some data in cookies. How exactly do i do that?
    Tried with few rest clients but didn't find any success.

  11. #11
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    27,746
    A search for cookie symbian c++ site:nokia.com wiki with Google works for me.

Similar Threads

  1. Post values to server using HTTP POST
    By ramtrg in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2011-08-23, 08:49
  2. Post values to server using HTTP POST
    By ramtrg in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2011-08-22, 11:34
  3. http post again and again
    By linzhiji in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2011-05-05, 06:43
  4. Sending a POST message to PHP - HTTP/1.0 works, but HTTP/1.1 doesn't?
    By anummiah in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2008-05-13, 16:53
  5. HTTP Client - Synchronous HTTP POST Calls?
    By symbian_ravi in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2006-04-16, 11:51

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved