×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Regular Contributor
    Join Date
    Nov 2010
    Posts
    93

    Thumbs up How to send some values to PHP script using HTTP Post

    I am new to Symbian C++. I want to send some values from my Symbian App to a PHP script using HTTP post.
    i want to send two values to PHP script....how to do this...Please provide any sample coding...

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: How to send some values to PHP script using HTTP Post

    have you checked SDK's examples folder already (Examples\AppProts\exampleclient) ?

  3. #3
    Regular Contributor
    Join Date
    Nov 2010
    Posts
    93

    Re: How to send some values to PHP script using HTTP Post

    yes i checked that..In that i see Httpclient Example....But I cannot find the particular http codings....I have tried from this url..http://www.developer.nokia.com/Devel...tworking.xhtml

    can you any other simple sample code....simply i want to send two values to PHP script alone.....
    Last edited by ramtrg; 2011-08-22 at 07:44.

  4. #4
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: How to send some values to PHP script using HTTP Post

    httpexampleclient.cpp has all the codes needed, basically from client side it does not matter whether the receiver is PHP or something else.

  5. #5
    Regular Contributor
    Join Date
    Nov 2010
    Posts
    93

    Thumbs up Post values to server using HTTP POST

    I have tried to post some values to server using HTTP Post.After these below coding, What i want to do...Please help me t complete this code...Also shall i want to include any header files for HTTP POST...please help me

    _LIT8(KPostUri, "http://www.mywebsite.com/fasttrack/apps.php");
    _LIT8(KPostParamName1, "number");
    _LIT8(KPostParamName2, "msg");
    _LIT8(KMimeType, "text/plain");

  6. #6
    Nokia Developer Champion
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,545

    Re: Post values to server using HTTP POST

    Look in the wiki ( e.g., articles such as http://www.developer.nokia.com/Commu...Url_parameters ), and the SDK documentation.

    If that's not enough to solve your problem, then more details are needed (more relevant code snippets, and any and all compiler and/or runtime errors).

  7. #7
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: Post values to server using HTTP POST

    Basically you do need loads of actual code there, those lines are just defining literal constants, i.e. string

    I did suggest some code samples already in: http://www.developer.nokia.com/Commu...ht=#post857470 that are rather minimal ones, you would basically justn need to remove all GET etc parts of the code (check any switch statements etc.)

    there is also bigger HTTP example available at examples section: http://www.developer.nokia.com/Devel...Code_examples/

    if you find these too hard to figure out, then please do try using Qt instead, it is generally easier to get started with.

  8. #8
    Regular Contributor
    Join Date
    Nov 2010
    Posts
    93

    Re: Post values to server using HTTP POST

    I have seen the "S60 Platform: HTTP Client Example v2.2" from "http://www.developer.nokia.com/Develop/Other_Technologies/Symbian_C++/Code_examples/". As Beginner, this sample is very hard to understand for me...So please give me some other simple Example....

  9. #9
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: Post values to server using HTTP POST

    the simpler one was the one I gave on that other thread.

    Also as suggested, Qt might be easier: http://www.developer.nokia.com/Commu..._Post_using_Qt

  10. #10
    Regular Contributor
    Join Date
    Nov 2010
    Posts
    93

    Thumbs up Post values to server using HTTP POST

    In my Symbian Application, I want to post two values to server. For that, I have tred like below coding....Is the below coding is correct....Please help me....

    Code:
    void CLiveTrackContainerView::PositionUpdatedL(TPositionInfoBase& aPosInfo)
    {
      ......
      ......
       
         if ( !Math::IsNaN(position.Longitude()) )
    		 {
    			....
    			.....
    			_LIT8(KPostUri, "http://mywebsite.com/fasttrack/apps.php");
    			_LIT8(Knumber, "01234567891");
    			_LIT8(Kmsg,ptr);  //here ptr is message i want to post, also it is a String
    		  }
    }
    
    void CHTTPExampleEngine::PostRequestL(const TDesC& anumber,const TDesC& amessage)
    	{
    		delete iFormEncoder;
    		iFormEncoder=null;
    		iFormEncoder = CHTTPFormEncoder::NewL();
    												
    		 TBuf8<50>	iTemp;
    		 TBuf8<50> 	iTemp2;
    			      		                         
    		 iTemp.Copy(anumber);	
    		 iTemp2.Copy(Knumber);
    		 iFormEncoder->AddFieldL(iTemp2,iTemp);
    			      		                         
    		 iTemp.Copy(amessage);	
    		 iTemp2.Copy(Kmsg);
    		 iFormEncoder->AddFieldL(iTemp2,iTemp);
    			      		                         
    		 iTransaction.Request().SetBody(*iFormEncoder);
    		 iTransaction.SubmitL();
    	}

  11. #11
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: Post values to server using HTTP POST

    Can you please just check the examples that were suggested in two previous thread:
    http://www.developer.nokia.com/Commu...sing-HTTP-POST
    http://www.developer.nokia.com/Commu...sing-HTTP-Post

    And see what they do, and then if they have problems, then please identify what kind of problem there is that you are having. Codes you have here are not really making too much sense.

  12. #12
    Regular Contributor
    Join Date
    Nov 2010
    Posts
    93

    Re: Post values to server using HTTP POST

    Thank You...

  13. #13
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,568

    Re: Post values to server using HTTP POST

    [The threads are merged now, you do not even have to click]

Similar Threads

  1. Working Code: Capture Image via camera, send it to web server with HTTP post in Php
    By kutax87 in forum Mobile Java Networking & Messaging & Security
    Replies: 5
    Last Post: 2011-04-15, 10:25
  2. How to call a PHP script with POST Parameters
    By gregb34 in forum Symbian Networking & Messaging (Closed)
    Replies: 7
    Last Post: 2008-08-14, 16:06
  3. HTTP post to a PHP script
    By duveit in forum Mobile Java Networking & Messaging & Security
    Replies: 5
    Last Post: 2008-06-06, 19:29
  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 POST, sending data, any idea how to fetch in PHP?
    By imarenic in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2003-11-13, 21:05

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •