Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try below , it might help you ...</p> <pre><code>NSString *purchaseURL=@"your url string inside"; NSString *postString=[NSString stringWithFormat:@"userid=1&amp;couponid=1&amp;Ccnum=7b6cd9a44365752cf39c1edf97890b72&amp;Cctype=Visa&amp;Cvv=434&amp;Billingfirstname=Ankit&amp;Billinglastname=Ankit&amp;Street=some&amp;getCity=mycity&amp;State=mystate&amp;getZip=54355&amp;Ccexpmonth=5&amp;Ccexpyear=2012&amp;Phone=43423342"]; NSData *postData=[postString dataUsingEncoding:NSUTF8StringEncoding]; NSURL *url = [NSURL URLWithString:purchaseURL]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; [request setHTTPMethod:@"POST"]; [request addValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; [request setHTTPBody:postData]; [request setValue:[NSString stringWithFormat:@"%i",postData.length] forHTTPHeaderField:@"Content-Length"]; [request setHTTPShouldHandleCookies:YES]; [request setTimeoutInterval:30]; [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; NSError *err=nil; NSData *responseData=[NSURLConnection sendSynchronousRequest:request returningResponse:nil error:&amp;err]; NSString *responseString=[[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; NSLog(@"response String is %@",responseString); </code></pre> <p>If still will give some error try changing post string as given below</p> <pre><code> NSMutableDictionary *postDix=[[NSMutableDictionary alloc] init]; [postDix setValue:@"1" forKey:@"userid"]; [postDix setValue:@"7b6cd9a44365752cf39c1edf97890b72" forKey:@"Ccnum"]; [postDix setValue:@"Visa" forKey:@"Cctype"]; [postDix setValue:@"434" forKey:@"Cvv"]; [postDix setValue:@"Ankit" forKey:@"Billingfirstname"]; [postDix setValue:@"Ankit" forKey:@"Billinglastname"]; [postDix setValue:@"some" forKey:@"Street"]; [postDix setValue:@"mycity" forKey:@"getCity"]; [postDix setValue:@"mystate" forKey:@"State"]; [postDix setValue:@"54355" forKey:@"getZip"]; [postDix setValue:@"5" forKey:@"Ccexpmonth"]; [postDix setValue:@"2012" forKey:@"Ccexpyear"]; [postDix setValue:@"43423342" forKey:@"Phone"]; NSString *postString=[NSString stringWithFormat:@"%@", postDix]; </code></pre> <p>OR changing post data as :-</p> <pre><code>NSMutableDictionary *postDix=[[NSMutableDictionary alloc] init]; [postDix setValue:@"1" forKey:@"userid"]; [postDix setValue:@"7b6cd9a44365752cf39c1edf97890b72" forKey:@"Ccnum"]; [postDix setValue:@"Visa" forKey:@"Cctype"]; [postDix setValue:@"434" forKey:@"Cvv"]; [postDix setValue:@"Ankit" forKey:@"Billingfirstname"]; [postDix setValue:@"Ankit" forKey:@"Billinglastname"]; [postDix setValue:@"some" forKey:@"Street"]; [postDix setValue:@"mycity" forKey:@"getCity"]; [postDix setValue:@"mystate" forKey:@"State"]; [postDix setValue:@"54355" forKey:@"getZip"]; [postDix setValue:@"5" forKey:@"Ccexpmonth"]; [postDix setValue:@"2012" forKey:@"Ccexpyear"]; [postDix setValue:@"43423342" forKey:@"Phone"]; NSMutableData *postData = [[NSMutableData alloc] init]; NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:postData]; [archiver encodeObject:postDix forKey:@"json"]; [archiver finishEncoding]; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload