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 7628263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:34:17+00:00 2026-05-31T05:34:17+00:00

I have a php website that returns YES or NO upon request. For example

  • 0

I have a php website that returns YES or NO upon request.
For example

http://www.test.com/test.php?variable=test1
will return me YES
and http://www.test.com/test.php?variable=test2
will return me NO

I am trying to get this response into an Objective-C application I am creating but I have no luck up to now.
Here is my code

NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.test.com/test.php?variable=test1"]
                                          cachePolicy:NSURLRequestUseProtocolCachePolicy
                                      timeoutInterval:60.0];
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if (theConnection) {
    NSMutableData *receivedData = [NSMutableData data];
    NSString *strData = [[NSString alloc]initWithData:receivedData encoding:NSUTF8StringEncoding];
    NSLog(@"This is the response: %@", strData);
}else {
 }

Can anybody help me on that? is there any other way to do it? Am I doing something wrong?

Thanks a lot guys

  • 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-05-31T05:34:18+00:00Added an answer on May 31, 2026 at 5:34 am
         - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
            {
                [receivedData appendData:data];
            // declre receivedData as a property of the class(in xxx.m)
                NSError *error=nil;
                NSDictionary *result=[NSJSONSerialization JSONObjectWithData:data options:
                                      NSJSONReadingMutableContainers error:&error];
                NSLog("%@", result);
        //do whatever you want...
    
               //the result dictionary is a JSON object and you can use it as KVC(key-value-coding) rules  
     }
    

    If your app targets iOS 5 just use this code to your xxx.m file under the method you create the request. And if you want to use it in some other versions of iOS, Take a look JSON parser frameworks..

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

Sidebar

Related Questions

Consider the following scenario: http://www.restserver.com/example.php returns some content that I want to work with
I'm developing a website in PHP and I have large JS files that I
Basically, we have an ASP website right now that I'm converting to PHP. We're
I currently have a news website setup in PHP/MYSQL that's a bit old and
I have a website that returns an access_token (i.e. Facebook). The redirect_uri has been
Using PHP how can I accurately test that a remote website supports the If-Modified-Since
I have a PHP website backed by a MySQL database and a small team
I have a problem with maintenance of my php based website. My website is
I have been using PHP and JavaScript for building my dad's website. He wants
I'm fairly new to PHP and have built a medium sized website using standard

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.