• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: how to implement xmlhttprequest in posting data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to implement xmlhttprequest in posting data


  • Subject: Re: how to implement xmlhttprequest in posting data
  • From: "I. Savant" <email@hidden>
  • Date: Mon, 11 Sep 2006 08:59:08 -0400


PLEASE stop posting the same request repeatedly. If someone can help you, they will respond when they read your message or have time to help. You're only annoying people by constantly reposting.


--
I.S.


On Sep 11, 2006, at 8:56 AM, Namrata Dwivedi wrote:

Hi!

i'm a newbie.I was trying to post an http request but i'm not able to do so.
could anyone help me with the code.
i'm putting the code here but when i'm using this the server is geting
a null value.
if something can be done in tis code itself or if something else can
be suggested.



#import "ConverterController.h"

@implementation ConverterController

- (IBAction)convert:(id)sender
{
	int num1,num2;
	num2 =[dollarField floatValue];
	num1 = [rateField floatValue];

	NSNumber *number1 = [NSNumber numberWithInt:num1];
	NSNumber *number2 = [NSNumber numberWithInt:num2];

	NSString* tempurlstring;
	NSString* URLString;
	NSString* resultString;

	NSMutableData *receivedData=nil;
	unsigned char *firstBuffer,*buffer;
	NSURLConnection* theConnection;
	int stringlen;


tempurlstring = [NSString
stringWithCString:"http://145.36.149.31:8080/CBuild/servlet/ HelloAddition"];


NSString *inputs;
NSString *tempinputs;


	tempinputs = [NSString stringWithCString:"input_1="];
	inputs = [tempinputs stringByAppendingFormat:@"%@ &input_2=%@",
number1,number2];

	NSMutableURLRequest *postURLRequest=[NSMutableURLRequest
requestWithURL:[NSURL URLWithString:tempurlstring]
													cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
	

[postURLRequest setHTTPMethod:@"POST"];
[postURLRequest setValue:@"text/xml" forHTTPHeaderField:@"Content- type"];





NSData *data = [NSData dataWithBytes:inputs length:[inputs length]]; [postURLRequest setHTTPBody:data];

	theConnection=[[NSURLConnection alloc] initWithRequest:postURLRequest
delegate:self];
	if (theConnection)
	{
	receivedData=[[NSMutableData data]retain];
	}


	firstBuffer = [receivedData mutableBytes];
	resultString = [NSString stringWithCString:firstBuffer];

	[amountField setStringValue:resultString];

@end
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: how to implement xmlhttprequest in posting data
      • From: Michael Jurewitz <email@hidden>
References: 
 >how to implement xmlhttprequest in posting data (From: "Namrata Dwivedi" <email@hidden>)

  • Prev by Date: how to implement xmlhttprequest in posting data
  • Next by Date: Re: Reading/Writing Text files
  • Previous by thread: how to implement xmlhttprequest in posting data
  • Next by thread: Re: how to implement xmlhttprequest in posting data
  • Index(es):
    • Date
    • Thread