Is there anyway of limiting the amount of lines that I write?
$filename = "news.txt";
$handle = fopen("$filename", "w");
fclose($handle);
foreach( $urls as $url ){
echo "<strong>$url</strong> added<br>";
$fp = fopen($filename, "a+");
$string = "$url\n";
$write = fputs($fp, $string);
fclose($fp);
As you can see thats a lot of information (below), is there a way I can just limit the first 10 and copy that to the news.txt?
Here is the file its copying:
26446982
59127786
84874480
15167708
19591525
70948049
39188913
35296963
04764628
42263209
28891385
45650864
81652360
38914846
44341442
54059216
76742817
03350102
75694850
13409968
88699929
40997142
44698440
30475717
16161625
84742089
04802407
13391755
15698915
55673704
34083539
79285986
60855905
63149321
47211303
61740294
53739920
74545032
81479337
83322505
45938704
04517672
61459180
67218293
81538379
70371011
67326814
04896116
57427434
46614589
79380048
98139187
30947911
96135812
37732071
17015138
75628860
53716314
04415183
53097640
60215789
15261610
60215620
18328849
15155367
31823793
30457750
76842891
47231806
62372518
51695721
36154292
00643441
95407740
97401415
21755583
86774402
23687863
38413583
10303072
31317796
84326252
02008382
15282088
44948339
18403579
96602974
53120950
39787552
77335839
66464338
30200532
19066064
44832921
93282123
94589129
88115840
93389372
38519927
53063932
53495461
59858921
86810056
61788576
88329388
93456888
23008664
66479443
07933936
15176136
42698142
63808275
50236147
30871307
05053365
58525030
18023049
81934885
24094648
21781779
02647852
16147579
91775570
50255131
45346042
92309581
43981610
46196721
85432808
18488962
24942012
06960026
12138869
13769909
73056785
33392728
36989357
49653195
40786135
45153771
63380005
48401677
89706408
46097278
68463221
46314640
91104305
04743987
27206719
54195019
10182747
61917325
89821080
29587801
05534564
00085943
03097820
48102695
46157406
24572892
41766802
06599974
67960018
27090451
35467723