Thank you Chris82, you almost slove all my problem it's a great help! However I have some questions again :P
1. What is the use for "#" in regexp?
2. Why use a "(.+?)" to wrap the code ".+?"?
3. What does "#is" mean?
4. Where can read more about regexp for PHP?
This is the code I made changes from your example, however it seems something is wrong with print() causing it not to display array or I am using the wrong functions.
PHP Code:
<?php
$fp = fopen("http://www.astrology-online.com/daily.htm", "r");
$content = fread($fp, 100000);
fclose($fp);
preg_match_all('#<!-- CHANGE \w{3,11} HERE -->(.+?)<!-- END \w{3,11} HERE -->#is', $content, $out);
print_r($out);
for($i = 1; $i <= 12; $i++) {
print($out[$i]);
}
?>

Originally Posted by
From PHP.NET

Originally Posted by
Output from the above code
Array ( [0] => Array ( [0] => A new you could help your attitude. The emotional state of peers may cause a problem for you. Discrimination will be in order. [1] => Someone you live with will, be impossible. You can make excellent career moves if you are open to the opportunities that exist. Problems with colleagues are likely. [2] => Outbursts of passion may cause arguments with your mate. Your lover will cost you dearly if you let them. Don't overdo it. [3] => You can gain approval, get kudos, and ask for help if you put a little heart into your speech or request. Don't let the moods of those you live with get you down. Travel and entertaining conversation will be informative and uplifting. [4] => You can count on getting a pat on the back for your efforts. You may find that others do not do things the way you want; however, if the job gets done, let it pass. Children or friends may try to talk you into lending them money. [5] => Use your ingenuity to manipulate things to get what you want. Talk to those in a position of power about your intentions. Show what a dedicated person you can be. [6] => You'll have amazing ideas, but superiors may try to block your attempts at implementing them. Travel will enhance romance and adventure. Others may want to steal your thunder when they realize your ideas are pretty solid. [7] => You may find that you are a little lucky today. Reevaluate your position and make decisions about your future goals. Don't cause a scene, but when you get home let your partner know how you feel and why. [8] => Trying to deal with your mate will be unproductive and possibly hurtful. You will impress others with your initiative and ability to accomplish while on short business trips. Pamper yourself; you deserve it. [9] => You could overreact to emotional situations regarding your relationship. Trips, educational pursuits, or projects that could lead to new outlooks should be on your agenda. Opportunities to get together with people in powerful positions could help you get ahead. [10] => You will be able to borrow money in order to invest. You can get into self awareness groups or look into physical enhancement programs. Romance can surface if you get into some of those fitness programs you've been putting off. [11] => Your mind will be on matters that deal with secret affairs. You may be overreacting to a situation at hand. Get busy trying to make more money. ) [1] => Array ( [0] => A new you could help your attitude. The emotional state of peers may cause a problem for you. Discrimination will be in order. [1] => Someone you live with will, be impossible. You can make excellent career moves if you are open to the opportunities that exist. Problems with colleagues are likely. [2] => Outbursts of passion may cause arguments with your mate. Your lover will cost you dearly if you let them. Don't overdo it. [3] => You can gain approval, get kudos, and ask for help if you put a little heart into your speech or request. Don't let the moods of those you live with get you down. Travel and entertaining conversation will be informative and uplifting. [4] => You can count on getting a pat on the back for your efforts. You may find that others do not do things the way you want; however, if the job gets done, let it pass. Children or friends may try to talk you into lending them money. [5] => Use your ingenuity to manipulate things to get what you want. Talk to those in a position of power about your intentions. Show what a dedicated person you can be. [6] => You'll have amazing ideas, but superiors may try to block your attempts at implementing them. Travel will enhance romance and adventure. Others may want to steal your thunder when they realize your ideas are pretty solid. [7] => You may find that you are a little lucky today. Reevaluate your position and make decisions about your future goals. Don't cause a scene, but when you get home let your partner know how you feel and why. [8] => Trying to deal with your mate will be unproductive and possibly hurtful. You will impress others with your initiative and ability to accomplish while on short business trips. Pamper yourself; you deserve it. [9] => You could overreact to emotional situations regarding your relationship. Trips, educational pursuits, or projects that could lead to new outlooks should be on your agenda. Opportunities to get together with people in powerful positions could help you get ahead. [10] => You will be able to borrow money in order to invest. You can get into self awareness groups or look into physical enhancement programs. Romance can surface if you get into some of those fitness programs you've been putting off. [11] => Your mind will be on matters that deal with secret affairs. You may be overreacting to a situation at hand. Get busy trying to make more money. ) ) Array
Notice: Undefined offset: 2 in C:\httpd\www\private\devel\horoscope\TMPmicsecu7zt.php on line 16
Notice: Undefined offset: 3 in C:\httpd\www\private\devel\horoscope\TMPmicsecu7zt.php on line 16
Notice: Undefined offset: 4 in C:\httpd\www\private\devel\horoscope\TMPmicsecu7zt.php on line 16
Notice: Undefined offset: 5 in C:\httpd\www\private\devel\horoscope\TMPmicsecu7zt.php on line 16
Notice: Undefined offset: 6 in C:\httpd\www\private\devel\horoscope\TMPmicsecu7zt.php on line 16
Notice: Undefined offset: 7 in C:\httpd\www\private\devel\horoscope\TMPmicsecu7zt.php on line 16
Notice: Undefined offset: 8 in C:\httpd\www\private\devel\horoscope\TMPmicsecu7zt.php on line 16
Notice: Undefined offset: 9 in C:\httpd\www\private\devel\horoscope\TMPmicsecu7zt.php on line 16
Notice: Undefined offset: 10 in C:\httpd\www\private\devel\horoscope\TMPmicsecu7zt.php on line 16
Notice: Undefined offset: 11 in C:\httpd\www\private\devel\horoscope\TMPmicsecu7zt.php on line 16
Notice: Undefined offset: 12 in C:\httpd\www\private\devel\horoscope\TMPmicsecu7zt.php on line 16
Seems like I have successfully grabbed all contents and place them in a array, but problem is how to display them to the browser.
Any ideas from anyone?
Bookmarks