- Impact
- 2
php text file parse help
I need a little php parse help. I wrote a program once that would read through a text file of the bible and parse it into MySql, I think using the ereg function. Thats been a few years ago and for some reason I can't wrap my head around it anymore?
I've got an example of the text files below. Inbetween the <--Page Break --> tags is a recipe, I need to read the first line as the Title and the rest as the content of the recipe.
Anyone feel like giving me a little code snippet
Can I use explode with <---Page_break---> as the delimiter. If so how would you do this ,get the array count etc..
I need a little php parse help. I wrote a program once that would read through a text file of the bible and parse it into MySql, I think using the ereg function. Thats been a few years ago and for some reason I can't wrap my head around it anymore?
I've got an example of the text files below. Inbetween the <--Page Break --> tags is a recipe, I need to read the first line as the Title and the rest as the content of the recipe.
Anyone feel like giving me a little code snippet
Code:
<-----------Page_Break----------->
16 BEAN SOUP
1 package 16 Bean Soup
3 bay leaves
1 tablespoon crushed oregano
2 cans no-fat chicken stock
Additional water to cover
3 stalks celery chopped
3 carrots diced
1 large onion chopped
3 cloves garlic sliced
1 pound turkey Italian sausage sliced
2 cans stewed (or diced) tomatoes
Combine first 5 ingredients (liquid should cover mixture by 1"-2") in
Crock Pot Cook on high for 2
hours Add remaining ingredients and shift cooker to low and cook for
additional 3 hours For more
zing, add cayenne or crushed red pepper when adding second set of
ingredients. Serve as
complete meal or over rice. Freezes well.
<-----------Page_Break----------->
ALL DAY CROCKPOT DELIGHT
2-3 lbs. boneless chuck, cut into 1 inch cubes
1/2 c. flour
1/4 c. butter
1 onion, sliced
1 tsp. salt
1/8 tsp. pepper
1 clove garlic, minced
2 c. beer
1/4 c. flour
Coat beef cubes with the 1/2 cup flour. Brown in melted butter. Drain
off excess fat. In crock pot, combine browned meat with onion, salt,
pepper, garlic and beer.
Cover and cook on low 5-7 hours (all day) until meat is tender. Turn
control to high. Dissolve remaining 1/4 cup flour in small amount of
water. Stir into meat mixture, cook on high 30-40 minutes. Serve with
rice and salad.
<-----------Page_Break----------->
ALL DAY MACARONI AND CHEESE
8 ounces elbow macaroni, cooked and drained
4 cups(16 ounces) shredded sharp Chedder Cheese
1 can (12 ounces) evaporated milk
1 1/2 cups milk
2 eggs
1 teaspoon salt
1/2 teaspoon black pepper
Place the cooked macaroni in crockpot that has been sprayed with
nonstick cooking spray. Add the remaining ingredents, all except 1 cup
of the cheese, mix well.
Sprinkle with the remaining 1 cup of cheese and then cover and cook
on low setting for 5 to 6 hours or until the mixture is firm and golden
around the edges. Do not remove the cover or stir until it has finished
cooking.
Can I use explode with <---Page_break---> as the delimiter. If so how would you do this ,get the array count etc..
Last edited:







