Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8628087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:26:50+00:00 2026-06-12T08:26:50+00:00

I am having 1 webservice in php which is having browser url mentioned bel

  • 0

I am having 1 webservice in php which is having browser url mentioned bel :

http:Domain/webservice/ACTEC_WebService.php?lastupdate=2012-09-01 01:00:00

Now when I try to fetch url in my iphone app, it is taking this url:

http://Domain/webservice/ACTEC_WebService.php?lastupdate=2012-09-01%2001:00:00

This is creating problem.

i have used this code for fetching data from my url.

     SBJSON *json = [SBJSON new];
        json.humanReadable = YES;
        responseData = [[NSMutableData data] retain];

        NSString *service = @"";
        NSString *str;
        str = @"LastUpdated";


        NSString *requestString = [NSString stringWithFormat:@"{\"LastUpdated\":\"%@\"}",str];

       // [[NSUserDefaults standardUserDefaults] setValue:nil forKey:@"WRONGANSWER"];

        NSLog(@"request string:%@",requestString);
        NSData *requestData = [NSData dataWithBytes: [requestString UTF8String] length: [requestString length]];


        NSString *fileLoc = [[NSBundle mainBundle] pathForResource:@"URLName" ofType:@"plist"];
        NSDictionary *fileContents = [[NSDictionary alloc] initWithContentsOfFile:fileLoc];
        NSString *urlLoc = [fileContents objectForKey:@"URL"];
        //urlLoc = [urlLoc stringByAppendingString:service];
        NSLog(@"URL : %@",urlLoc);

        NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL: 
                                        [NSURL URLWithString:urlLoc]];  
        NSString *postLength = [NSString stringWithFormat:@"%d", [requestData length]];
        [request setHTTPMethod: @"POST"];
        [request setValue:postLength forHTTPHeaderField:@"Content-Length"];
        [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
        [request setHTTPBody:requestData];

        NSError *respError = nil;
        NSData *returnData = [NSURLConnection sendSynchronousRequest: request returningResponse: nil error: &respError ];
        NSString *responseString = [[NSString alloc] initWithData:returnData encoding: NSUTF8StringEncoding];
        NSLog(@"Resp : %@",responseString);

        if (respError) 
        {
            //        NSString *msg = [NSString stringWithFormat:@"Connection failed! Error - %@ %@",
            //                         [respError localizedDescription],
            //                         [[respError userInfo] objectForKey:NSURLErrorFailingURLStringErrorKey]]; 
            UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"ACTEC" 
                                                                message:@"check your network connection" delegate:self cancelButtonTitle:@"OK" 
                                                      otherButtonTitles:nil];
            [alertView show];
            [alertView release];

        } 
        else
        {
......
}

here,i am getting null response as url is getting decoded…How can I make this solved…
Help me out.
Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T08:26:52+00:00Added an answer on June 12, 2026 at 8:26 am
    NSString *urlLoc = [[fileContents objectForKey:@"URL"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 
    NSMutableData *postData = [NSMutableData data];
        NSMutableURLRequest *urlRequest;        
        [postData appendData: [[NSString stringWithFormat: @"add your data which you want to send"] dataUsingEncoding: NSUTF8StringEncoding]];  
        NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
        urlRequest = [[NSMutableURLRequest alloc] init];
        [urlRequest setURL:[NSURL URLWithString:urlLoc]];
        [urlRequest setHTTPMethod:@"POST"];
        [urlRequest setValue:postLength forHTTPHeaderField:@"Content-Length"];
        [urlRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
        [urlRequest setHTTPBody:postData];
    
        NSString *temp = [[NSString alloc] initWithData:postData encoding:NSUTF8StringEncoding];
        NSLog(@"\n\nurl =%@ \n posted data =>%@",urlLoc, temp);
    

    check nslog. that which data u send to service.

    NSData *response = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:nil error:nil];
    NSString *json_string = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
    NSLog(@"json_string >> %@",json_string);
    

    Maybe this will help you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having my webservice for my mobile app which written using JAVA. I
I have a php webservice which can be called (from mobile phones) to perform
I'm communicating with a SOAP webservice using PHP and I'm having trouble. // Create
I am having a problem in passing parameters to webservice which except POST data
I'm building a webservice which has a webmethod returning a Dataset object. I'm having
I am having problems with encoding in ID3 tags. I query a webservice which
Having a deadlock in webservice + hibernate... No idea why. I have the following
Having some trouble getting a screenscraper webservice up and running on a weblogic 10.3.3
I am having a problem connecting to the server hosting my webservice when I
I'm having some doubts about how to upload something to a WebService. I've been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.