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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:24:07+00:00 2026-06-09T21:24:07+00:00

I have to connect to a URL to check whether the records is empty.

  • 0

I have to connect to a URL to check whether the records is empty. The response looks something like this:

<?xml version = "1.0" encoding = "UTF-8"?>
<find>
<record_id>1234</record_id>
<no_record>00001</no_record>
<entry_num>00001</entry_num>
<session-id>aijheifaohqrihelrkqn324tlejaofjaf</session-id>
</find>

My codes:

                NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init]
                                                autorelease];
                [request setURL:[NSURL URLWithString: finalSearchURL]];

                // Content-Type related.
                [request setValue:@"application/x-www-form-urlencoded"
               forHTTPHeaderField:@"Content-Type"];

                // Create Connection.
                NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];

                if (conn) {
                    // The connection was established.
                    NSMutableData *receivedData =  [[NSMutableData alloc] initWithContentsOfURL:[NSURL URLWithString:request]];
                    NSLog( @"Data will be received from URL: %@", request.URL );
                    NSLog(@"Recieved Data 2: %@", receivedData);
                }
                else
                {
                    // The download could not be made.
                    NSLog( @"Data could not be received from: %@", request.URL );
                }

But it returns me:

Recieved Data : <3c3f786d 6c207665 7273696f 6e203d20 22312e30 2220656e 636f6469 6e67203d 20225554 462d3822 3f3e0a3c 66696e64 3e0a3c73 65745f6e 756d6265 723e3031 39303633 3c2f7365 745f6e75 6d626572 3e0a3c6e 6f5f7265 636f7264 733e3030 30303030 3030313c 2f6e6f5f 7265636f 7264733e 0a3c6e6f 5f656e74 72696573 3e303030 30303030 30313c2f 6e6f5f65 6e747269 65733e0a 3c736573 73696f6e 2d69643e 4d505843 33323433 58564336 4534454a 41464232 45473541 39374237 584e3832 43554631 4e314234 584e4c37 424c5947 4e533c2f 73657373 696f6e2d 69643e0a 3c2f6669 6e643e0a 20>

Can anyone help to tell me what am I doing wrong? This is my first attempt for getting response from a url please help thanks!

  • 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-09T21:24:08+00:00Added an answer on June 9, 2026 at 9:24 pm

    See the data as a string this way:

    NSString *string = [[NSString alloc] initWithData:receivedData encoding:NSUTF8StringEncoding];
    NSLog(@"the xml string is %@", string);
    

    If the parsing goal is simple enough – like just to find the value of one tag – you can use string methods to parse. Otherwise, NSXMLParser or several other options are available.

    To see if the string contains a substring, you can do something like this:

    if (string) {
        NSRange range = [string rangeOfString:@"<session-id>"];
        if (range.location != NSNotFound) {
            // session-id tag is at index range.location, so we know it's there
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't figure out why this is. I have a connect method that works
i have this function pymssql.connect(host=my host,user=my user,password=my pass,database=mydb) I want to read the user
I have this NSXMLParser that parsing an XML file from a webserver parser =
I have form like this: <input type='text' name='people' id='namepeople'> <input type='hidden' name='idpeople' id='idpeople'> <input
I'm using this to check for the availability of a URL: $fp = fsockopen($url,
I have to connect to a poorly implemented server that only understands Content-Type (capital-T)
I have facebook connect button on a page of my site and I want
I have to do an assignment in JAVA in which I have to connect
I have implemented Facebook Connect into a HTML page exactly as the tutorial explains
I have a facebook connect site using the c# facebook toolkit. I want to

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.