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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:14:28+00:00 2026-06-09T11:14:28+00:00

I have an interesting scenario and need to know if it can even be

  • 0

I have an interesting scenario and need to know if it can even be done in Cocoa.

I have tried and failed to find a hourly weather forecast api that is free and will let me see hour-by-hour forecast for a certain city/zipcode. So for an alternate approach what I am trying to do is to read the whole HTML page source and try to see if I can strip out the hourly weather portion so that I can use it in my iPhone app.

NSString *request = @"http://www.findlocalweather.com/hourly/il/chicago.html";

    NSURL *URL = [NSURL URLWithString:request];
    NSError *error;    
    NSString *HTML = [NSString stringWithContentsOfURL:URL encoding:NSASCIIStringEncoding error:&error];

    NSLog(@"HTML: %@", HTML);

If you go to the http://www.findlocalweather.com/hourly/il/chicago.html link you will see the grid hourly forecast. What I need to do is from that HTML source I need to read each date, clouds and temp lines and put that into arrays. e.g.

NSMutableArray1 will contain objects “AUG 05 9:00 AM, AUG 05 10:00 AM, AUG 05 11:00 AM …”

NSMutableArray2 will contain objects “Mostly Cloudy, Mostly Sunny …”

NSMutableArray3 will contain objects “73, 84, 76, 91 ….” (temp in degrees)

Can this be done? Anyone ever tried parsing a HTML page source string to get what you want out of it?

  • 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-09T11:14:29+00:00Added an answer on June 9, 2026 at 11:14 am

    You could do it easily with NSRegularExpression

    NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:EnterStringWithPatternHere options:0 error:NULL];
    NSArray *matches = [regex matchesInString:webPage options:0 range:NSMakeRange(0, [webPage length])];
    

    There are some nice tutorials how to use Regular Expressions (They are almost the same in most programming languages, but look after the specialties of NSRegEx)

    Example: Parsing pdf links out of HMTL file.

    NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"href=\"([^<>]*).pdf\"" options:0 error:NULL];
    NSArray *matches = [regex matchesInString:webPage options:0 range:NSMakeRange(0, [webPage length])];
    for (int i=0; i<[matches count]; i++) {
        NSTextCheckingResult *match = [matches objectAtIndex:i];
     NSString *theFullString = [NSString stringWithFormat:@"%@.pdf",[webPage   substringWithRange:[match rangeAtIndex:1]]];}
    

    I wrote this code a while ago. I would advise you experiment a bit and make use of NSLog or Breakpoints. This will help a lot. It takes some time to get into the RegEx Stuff but it works very good.

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

Sidebar

Related Questions

We have an interesting scenario I need to sort out: 1) We have an
I have an interesting scenario that I need assistance with. I have a classic
I have an interesting scenario. I have a task model which has a task
I'm using SQL Server 2008. I have an interesting scenario where a stored procedure
I have the following interesting scenario: I've install ruby 1.9.2 via RVM and it
I have very interesting scenario: I've specified two controllers, one for global events and
I have an interesting scenario and the answer isn't jumping out at me. I've
I have the following interesting scenario: The test system, in my case BogusGateway of
I just came across an interesting scenario. I have a class in C#: public
I have an interesting scenario. I have a custom TableViewCell class which contains a

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.