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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:45:44+00:00 2026-05-15T14:45:44+00:00

I would like to get some information from a website. I have already got

  • 0

I would like to get some information from a website. I have already got the HTML code of the website. However, I would like to get more header information of the website (e.g. http status code)

After read the apple library, I found that there are 2 methods which can display those information. However, I can only use one of the methods (has warning), another cannot be used.

The following is the code.

NSHTTPURLResponse *response = nil;
NSError *error = nil;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];

NSString *data=[[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];

NSDictionary *responseAlllHeaderFields = [response allHeaderFields];
// how can I convent the NSDictionary to the NSString, I cannot use the NSLog to display the information
NSLog(responseAlllHeaderFields); // <-- wrong

// returns the HTTP status code for the response
NSInteger *responseStatusCode = [response statusCode];
// warning: initialization makes pointer from integer without a cast
NSLog(@"\nThe status code is %d\n", responseStatusCode);

Besides, are there are any other methods to get the header informatino?

Thank you very much.

  • 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-15T14:45:44+00:00Added an answer on May 15, 2026 at 2:45 pm

    Thank you for your reply.

    However, there are some warning.

    The following is the code

    NSInteger *responseStatusCode = [[response statusCode] intValue];
    NSLog(@"\nThe status code is %d\n", responseStatusCode);
    
    NSInteger *responseStatusCode = [response statusCode];
    [responseStatusCode intValue];
    NSLog(@"\nThe status code is %d\n", responseStatusCode);
    
    NSInteger *responseStatusCode = [response statusCode];
    NSLog(@"\nThe status code is %d\n", [responseStatusCode intValue]);
    

    I have no ideas why the above 3 methods are wrong and cannot be work.

    Thank you.

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

Sidebar

Related Questions

I would like to get some information about the device, os etc. from the
I would like to get up-to-date information on Google's index of a website, and
I'm a lone developer who would like to get some structure to my projects.
I am running C# framework 2.0 and I would like to get some of
I would like to create a javascript modal pop up window to get some
I would like to get data from from different webpages such as addresses of
I use $.ajax() to get some HTML pages from my server. The retrun contains
I would like to get a sum from a column, with and without a
Would like to get a list of advantages and disadvantages of using Stored Procedures.
I would like to get the path to the execution directory of a Windows

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.