iphone - Pull information from a web page that ends in .php -


i need pull bunch of data website (https://www.bowdoin.edu/apps/mobile/nutrition.php - huge blob of text) , save attributes of core data entities.

here's block of text website might (trimmed down)

monday, may 06, 2013|thorne|breakfast item|portion|sfa(g)|fatrn(g)|pufa(g)|mono(g)|chol(mg)|na(mg)|cho(g)|tdfb(g)|sugar(g)|pro(g)|vtaiu(iu)|vitc(mg)|ca(mg)|fe(mg)|kcal|fat(g) oatmeal|2/3  cup|0.18|0|0.37|0.32|0|261|10.81|1.7|0|2.6|0|0|10.91|0.7|62|1 pancakes|2 each|0.289|0|0.486|0.486|6|350|33.08|1.5|5.54|2.99|29.98|2.75|72.12|1.03|160|1.47  monday, may 06, 2013|thorne|lunch item|portion|sfa(g)|fatrn(g)|pufa(g)|mono(g)|chol(mg)|na(mg)|cho(g)|tdfb(g)|sugar(g)|pro(g)|vt    aiu(iu)|vitc(mg)|ca(mg)|fe(mg)|kcal|fat(g) deli bar  lunch|portion|4.384|0.003|1.157|2.731|47|735|33.12|2.9|3.5|15.06|807.02|4.91|148.58|3.07|297|11.46 chilled fruit s|6 oz portion|0.837|0|0.089|0.359|5|24|15.48|0.6|10.75|1.86|635.11|46.86|109.75|0.53|79|1.42  monday, may 07, 2013|thorne|lunch item|portion|sfa(g)|fatrn(g)|pufa(g)|mono(g)|chol(mg)|na(mg)|cho(g)|tdfb(g)|sugar(g)|pro(g)|vt    aiu(iu)|vitc(mg)|ca(mg)|fe(mg)|kcal|fat(g) italian bread|slice|0.245|0.005|0.985|0.486|0|172|10.73|0.7|0.48|1.61|0|0|2.81|0.6|67|1.84 orange gelatin |1/2 cup|0|0|0|0|0|53|17.59|0|0|1.52|0|0|2.74|0.04|74|0 

research has pointed me nsurlconnection , nsstring's stringwithcontentsoffile:encoding:error: method, unsure how use them.

i guess main issue parsing, i'll figure out coredata stuff after. suggestions?

here's ended doing:

1) data in form of nsstring:

nsurl *url = [nsurl urlwithstring:@"https://www.<school>.edu/apps/mobile/nutrition.php"]; nsstring* filecontents = [nsstring stringwithcontentsofurl:url encoding:nsutf8stringencoding error:nil]; 

2) parse through huge nsstring, saving each row object in dictionary, first entry in row key array saved in row. (haven't yet implemented)


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -