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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:18:39+00:00 2026-05-27T19:18:39+00:00

I’m new in internet connection for iOS. I’m trying to get data from special

  • 0

I’m new in internet connection for iOS.
I’m trying to get data from special site.

The following codes works great with all site to see the data in the url.

However if I change it the special site to get their data it return NULL!!

I think the site some how block this type of implementation. Because the site present some XML information.

NSString *URLString = @"http://www.specialsite.com/";
NSURL *postURL = [NSURL URLWithString:URLString];
NSURLRequest *postRequest = [NSURLRequest requestWithURL:postURL];
NSURLResponse *response = nil;
NSError *error = nil;
NSData *responseData = [NSURLConnection sendSynchronousRequest:postRequest returningResponse:&response error:&error];

if (responseData) {
    NSLog(@"Response was %@", [NSString stringWithCString:[responseData bytes] encoding:NSUTF8StringEncoding]);          
}

Also the response in console is:

2011-12-26 12:24:37.245 Arz[6113:207] Response was (null)

Remember if I change:

    NSString *URLString = @"http://www.specialsite.com/";

to

    NSString *URLString = @"http://www.apple.com/";

working prefect!

Sorry I can’t say the name of the site in here (public).

  • 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-27T19:18:40+00:00Added an answer on May 27, 2026 at 7:18 pm

    You can try to use the convenience method:

    NSString *mydata = [[NSString alloc] initWithContentsOfURL:@"http://example.com"];
    

    If this doesn’t work, i would get the response headers using curl from the terminal and see what happens.

    curl -I http://www.apple.com
    

    Alternatively you can print the response headers just inside XCode when using NSHTTPURLResponse instead:

    NSURLRequest *postRequest = [NSURLRequest requestWithURL:[NSURL URLWithString: @"http://www.apple.com"]];
    NSHTTPURLResponse *response = nil;
    NSError *error = nil;
    NSData *responseData = [NSURLConnection sendSynchronousRequest:postRequest returningResponse:&response error:&error];
    
    NSDictionary *dict = [response allHeaderFields];
    NSLog(@"Status code: %d",[response statusCode]);
    NSLog(@"Headers:\n %@",dict.description);
    NSLog(@"Error: %@",error.description);
    //NSLog(@"Response data: %@",[[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]);
    

    Look for the response code e.g. HTTP/1.1 200 OK

    The response code and the headers will tell you what’s going wrong from the server’s point of view. If the response code is anything else than 200 you will not receive the expected data. Here you can find a list of HTTP Status codes: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.