Re: how to implement xmlhttprequest in posting data
Re: how to implement xmlhttprequest in posting data
- Subject: Re: how to implement xmlhttprequest in posting data
- From: Michael Jurewitz <email@hidden>
- Date: Mon, 11 Sep 2006 12:25:18 -0700
He's modified his request a bit, changed his code and obviously
incorporated some new knowledge and guesses as to where he should be
heading for the solution.
PLEASE don't jump on people so quickly, we're all here to try to help
each other.
-Michael Jurewitz
On Sep 11, 2006, at 5:59 AM, I. Savant wrote:
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:
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
_______________________________________________
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