Solved

<EOL> tag in .csv file

Posted on 2014-01-23
9
551 Views
Last Modified: 2014-01-23
I have a php program that creates a .csv file from an input file that has the <EOL> tags so please tell me how to remove those tags so they won't be in my output file.

<?php

$data=array();
if (($handle = fopen("weight_nsp_ben.csv", "r")) !== FALSE)
{
    //fetch the "[products]" row, but do nothing with it
    fgetcsv($handle, 1000, ';');

    //fetch the headers row
    $headers = fgetcsv($handle, 1000, ';');
	//print_r ($headers);

    //locate the index of product_code and weight
    $product_code=array_search('!PRODUCTCODE',$headers);
    $weight=array_search('!WEIGHT',$headers);
//echo $weight;
    while (($row = fgetcsv($handle, 1000, ";")) !== FALSE) 
    {
		//var_dump($row[$product_code]);
		if (strlen($row[$product_code]) > 0) {
        //$data[]=sprintf('"%s","%s"',$row[$product_code], $row[$weight]); // original
		$data[]=sprintf('%s|%s',$row[$product_code], $row[$weight]);
		
		}
    }
    fclose($handle);

    file_put_contents(getcwd().'/result.csv', implode(PHP_EOL,$data) );
}

?>

Open in new window


This is the input for the .csv file

[PRODUCTS]
!PRODUCTID;!PRODUCTCODE;!PRODUCT;!CLEAN_URL;!WEIGHT;!LIST_PRICE;!DESCR;!FULLDESCR;!KEYWORDS;!TITLE_TAG;!META_KEYWORDS;!META_DESCRIPTION;!AVAIL;!RATING;!FORSALE;!SHIPPING_FREIGHT;!FREE_SHIPPING;!DISCOUNT_AVAIL;!MIN_AMOUNT;!LENGTH;!WIDTH;!HEIGHT;!LOW_AVAIL_LIMIT;!FREE_TAX;!CATEGORYID;!CATEGORY;!POS;!MEMBERSHIP;!PRICE;!TAXES;!ADD_DATE;!VIEWS_STATS;!SALES_STATS;!DEL_STATS;!SMALL_ITEM;!SEPARATE_BOX;!ITEMS_PER_BOX;!MANUFACTURERID;!MANUFACTURER
114;"1693-4";"Aloe Vera, Whole Leaf";Aloe-Vera-Whole-Leaf;2.370;35.650;"(32 fl. oz.), Stock No. 1693-4";"<p><span class=""heading"">Benefits</span><br /> <EOL> <EOL>    &bull; Nourishes the digestive and intestinal systems.<br /> <EOL>    &bull; Soothes internal tissues of the digestive and intestinal tracts.<br /> <EOL>    &bull; Contains vitamins, minerals and other important nutrients.<br /> <EOL>    &bull; Supports intestinal health.</p> <EOL> <EOL> <EOL><p><span class=""heading"">How It Works</span><br /> <EOL> <EOL>Aloe vera is a nutritional storehouse. It also contains salicylate and prostaglandins. Aloe nutritionally benefits the intestinal system. Aloe soothes the tissues lining the digestive tract. It contains many biologically active compounds that support the digestion and absorption of food and nourish the intestinal system.</p> <EOL> <EOL><p>Many companies manufacture aloe vera, but most products on the market have lost much of the plant's original benefits due to over-processing. <span class=""boldblack"">Beware of aloe vera juice that claims to have no disagreeable taste. Removing this taste can leave you with a product that is only 10ñ15 percent aloe vera at best.</span></p> <EOL> <EOL><p><span class=""boldblack"">Nature's Sunshine Products Whole Leaf Aloe Vera provides a higher level of mucopolysaccharides than regular filleted aloe vera.</span> Only the intense cleansing components have been removed, leaving a high level of mucopolysaccharides (7,000 mg per liter).</p> <EOL> <EOL><p><span class=""heading"">Ingredients</span><br /> <EOL>Aloe vera inner leaf juice concentrate and purified water.</p> <EOL> <EOL><p><span class=""heading"">Product Label</span> - <span style=""color:#909""> <EOL>Place your mouse cursor over the image to zoom in to read the label. <EOL></span></p> <EOL><img src=""/Resources/labels/1693.jpg"" alt=""Product Label"" /> <EOL> <EOL> <EOL><p><span class=""heading"">Recommended Use</span><br /> <EOL>Drink 2ñ6 oz. Aloe Vera Juice daily as is or mixed with water or juice. Or, drink 1 oz. Whole Leaf Aloe Vera Juice mixed with 8 oz. of water or juice four times daily. Shake well before using and refrigerate after opening.</p> <EOL> <EOL><p><span class=""heading"">Customer Comments</span><br /> <EOL>&quot;A friend recommended I try Aloe Vera and    I bought some of the <b>WHOLE LEAF ALOE VERA</b> and    took it twice a day as mentioned. I could tell a difference in only a week    on improvement in my energy and intestinal system.. I love    that Aloe Vera!&quot; Veronica S. </p>   <EOL>";"";"";"";"";100;26;Y;0;N;Y;1;0;0;0;10;N;28;"Shop A - Z";0;;23.750;"Sales Tax";Wednesday 01 June 2011 02:03:15 AM;1519;1;1;Y;N;1;"0";
463;"1505-6";"Alpha Lipoic Acid";Alpha-Lipoic-Acid;0.110;44.650;"(60 capsules), Stock No. 1505-6";"  <p align=""left""><!-- begin mailer -->Alpha Lipoic Acid (ALA) is often called the universal antioxidant. It is both fat- and water-soluble and can cross any membrane in the body to protect all cells. Alpha Lipoic Acid also enhances the efforts of other  antioxidants, helps support the body&#146;s natural removal of metal toxins and offsets oxidative stress. <!-- end mailer --></p><p align=""left"">  In addition    to its antioxidant properties, ALA directs    calories away from fat production  and toward energy production, supports  blood sugar levels already within  the normal range and enhances the nervous  and cardio-vascular systems.  </p><table width=""411"" border=""2"" cellspacing=""3"" cellpadding=""3"" align=""center"" bordercolor=""#FF0000""><tr><td height=""144""><p align=""left""><b>Benefits</b><br>  <b>&#149; Enhances        the efforts of other antioxidants.<br>&#149; Encourages energy production.<br>&#149; Supports blood sugar levels already within the normal range.<br>&#149; Protects the liver.<br>&#149; Supports the cardiovascular system.<br>&#149; Supports nerve cell health. </b></p></td></tr></table><p align=""left""> <b>How It Works</b><br>Most antioxidants are either water- or fat-soluble. Alpha lipoic acid is both, making its protective powers available to all cells in the body. Consequently, ALA can protect the integrity of the cell membrane as well as offset cell stress. ALA protects the cell membrane and promotes mitochondrial activity to keep your body and its tissues young.<br><br><b>NSP (Nature's Sunshine Products') Advantage</b><br>NSP combines Alpha Lipoic Acid with turmeric. Turmeric is a source of curcumin, a liver-protecting antioxidant. Each capsule provides 250 mg alpha lipoic acid, the dosage recommended by most doctors for optimal health.<br><br>These statements have not been evaluated by the Food and Drug Administration. This product is not intended to diagnose, treat, cure or prevent any disease.<br> <br><b>Scientific Support</b><br>Scientific studies have shown that ALA enhances energy levels, protects neural cells from oxidative damage and helps maintain myocardial function. 1<br><br>Studies in humans show that supplementation with lipoic acid causes a relevant increase in energy levels available to the brain and skeletal muscle during exercise. 2<br><br>ALA supplementation has also been shown maintain blood pressure levels that are already within the normal range.<br><br><b>Ingredients</b><br>Each capsule contains 250 mg of alpha lipoic acid.<br><br><b>Recommended Use</b><br>Take 1 capsule with a meal twice daily.<br><br><b>References</b><br>1 - Liu J, Atamna H, Kuratsune H, Ames BN. Delaying brain mitochondrial decay and aging with mitochondrial antioxidants and metabolites. Ann N Y Acad Sci 2002 Apr; 959: 133-66.<br><br>2 - Barbiroli B, Medori R, Tritschler HJ, Klopstock T, Seibel P, Reichmann H, Lotti S, Lodi R, Zaniol P. Lipoic (thioctic) acid increases brain energy availability and skeletal muscle performance as shown by in vivo 31P-MRS in a patient with mitochondrial cytopathy. J Neurol 1995 Jul; 242: 472-7. </p>";"";"";"";"";100;20;Y;0;N;Y;1;0;0;0;10;N;23;"Supplements";0;;29.750;"Sales Tax";Wednesday 01 June 2011 02:03:15 AM;2082;1;0;Y;N;1;"0";
;;;;;;;;;;;;;;;;;;;;;;;;28;"Shop A - Z";0;;;;;;;;;;;;
1;"3894-0";"Amber Bottle, Empty";Amber-Bottle-Empty;0.080;2.650;"(15 ml.) Stock No. 3894-0";"<br> <EOL><br> <EOL><br> <EOL><br>";"";"";"";"";100;65;Y;0;N;Y;1;0;0;0;10;N;1;"Essential Oils - 100% Pure";0;;1.750;"Sales Tax";Wednesday 01 June 2011 02:03:24 AM;1923;2;0;Y;N;1;"0";
;;;;;;;;;;;;;;;;;;;;;;;;66;"Essential Oils - 100% Pure|Essential Oil Accessories";0;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;28;"Shop A - Z";0;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;132;"UPC Missing";0;;;;;;;;;;;;

Open in new window


This is the output of the .csv file

1693-4|<p><span class="heading">Benefits</span><br /> <EOL> <EOL>    &bull; Nourishes the digestive and intestinal systems.<br /> <EOL>    &bull; Soothes internal tissues of the digestive and intestinal tracts.<br /> <EOL>    &bull; Contains vitamins, minerals and other important nutrients.<br /> <EOL>    &bull; Supports intestinal health.</p> <EOL> <EOL> <EOL><p><span class="heading">How It Works</span><br /> <EOL> <EOL>Aloe vera is a nutritional storehouse. It also contains salicylate and prostaglandins. Aloe nutritionally benefits the intestinal system. Aloe soothes the tissues lining the digestive tract. It contains many biologically active compounds that support the digestion and absorption of food and nourish the intestinal system.</p> <EOL> <EOL><p>Many companies manufacture aloe vera, but most products on the market have lost much of the plant's original benefits due to over-processing. <span class="boldblack">Beware of aloe vera juice that claims to have no disagreeable taste. Removing this taste can leave you with a product that is only 10ñ15 percent aloe vera at best.</span></p> <EOL> <EOL><p><span class="boldblack">Nature's Sunshine Products Whole Leaf Aloe Vera provides a higher level of mucopolysaccharides than regular filleted aloe vera.</span> Only the intense cleansing components have been removed, leaving a high level of mucopolysaccharides (7,000 mg per liter).</p> <EOL> <EOL><p><span class="heading">Ingredients</span><br /> <EOL>Aloe vera inner leaf juice concentrate and purified water.</p> <EOL> <EOL><p><span class="heading">Product Label</span> - <span style="color:#909"> <EOL>Place your mouse cursor over the image to zoom in to read the label. <EOL></span></p> <EOL><img src="/Resources/labels/1693.jpg" alt="Product Label" /> <EOL> <EOL> <EOL><p><span class="heading">Recommended Use</span><br /> <EOL>Drink 2ñ6 oz. Aloe Vera Juice daily as is or mixed with water or juice. Or, drink 1 oz. Whole Leaf Aloe Vera Juice mixed with 8 oz. of water or juice four times daily. Shake well before using and refrigerate after opening.</p> <EOL> <EOL><p><span class="heading">Customer Comments</span><br /> <EOL>&quot;A friend recommended I try Aloe Vera and    I bought some of the <b>WHOLE LEAF ALOE VERA</b> and    took it twice a day as mentioned. I could tell a difference in only a week    on improvement in my energy and intestinal system.. I love    that Aloe Vera!&quot; Veronica S. </p>   <EOL>
1505-6|  <p align="left"><!-- begin mailer -->Alpha Lipoic Acid (ALA) is often called the universal antioxidant. It is both fat- and water-soluble and can cross any membrane in the body to protect all cells. Alpha Lipoic Acid also enhances the efforts of other  antioxidants, helps support the body&#146;s natural removal of metal toxins and offsets oxidative stress. <!-- end mailer --></p><p align="left">  In addition    to its antioxidant properties, ALA directs    calories away from fat production  and toward energy production, supports  blood sugar levels already within  the normal range and enhances the nervous  and cardio-vascular systems.  </p><table width="411" border="2" cellspacing="3" cellpadding="3" align="center" bordercolor="#FF0000"><tr><td height="144"><p align="left"><b>Benefits</b><br>  <b>&#149; Enhances        the efforts of other antioxidants.<br>&#149; Encourages energy production.<br>&#149; Supports blood sugar levels already within the normal range.<br>&#149; Protects the liver.<br>&#149; Supports the cardiovascular system.<br>&#149; Supports nerve cell health. </b></p></td></tr></table><p align="left"> <b>How It Works</b><br>Most antioxidants are either water- or fat-soluble. Alpha lipoic acid is both, making its protective powers available to all cells in the body. Consequently, ALA can protect the integrity of the cell membrane as well as offset cell stress. ALA protects the cell membrane and promotes mitochondrial activity to keep your body and its tissues young.<br><br><b>NSP (Nature's Sunshine Products') Advantage</b><br>NSP combines Alpha Lipoic Acid with turmeric. Turmeric is a source of curcumin, a liver-protecting antioxidant. Each capsule provides 250 mg alpha lipoic acid, the dosage recommended by most doctors for optimal health.<br><br>These statements have not been evaluated by the Food and Drug Administration. This product is not intended to diagnose, treat, cure or prevent any disease.<br> <br><b>Scientific Support</b><br>Scientific studies have shown that ALA enhances energy levels, protects neural cells from oxidative damage and helps maintain myocardial function. 1<br><br>Studies in humans show that supplementation with lipoic acid causes a relevant increase in energy levels available to the brain and skeletal muscle during exercise. 2<br><br>ALA supplementation has also been shown maintain blood pressure levels that are already within the normal range.<br><br><b>Ingredients</b><br>Each capsule contains 250 mg of alpha lipoic acid.<br><br><b>Recommended Use</b><br>Take 1 capsule with a meal twice daily.<br><br><b>References</b><br>1 - Liu J, Atamna H, Kuratsune H, Ames BN. Delaying brain mitochondrial decay and aging with mitochondrial antioxidants and metabolites. Ann N Y Acad Sci 2002 Apr; 959: 133-66.<br><br>2 - Barbiroli B, Medori R, Tritschler HJ, Klopstock T, Seibel P, Reichmann H, Lotti S, Lodi R, Zaniol P. Lipoic (thioctic) acid increases brain energy availability and skeletal muscle performance as shown by in vivo 31P-MRS in a patient with mitochondrial cytopathy. J Neurol 1995 Jul; 242: 472-7. </p>
3894-0|<br> <EOL><br> <EOL><br> <EOL><br>
39-8|<p><span class="heading">Benefits</span><br /> <EOL>&bull; Immune system support.<br /> <EOL>&bull; Provides protection to cells.<br /> <EOL>&bull; May strengthen the body's defense against common illnesses.</p> <EOL>   <EOL><p>After much research and testing, Nature's Sunshine   Products proudly introduces this powerful Peruvian herb known for its immune system   support.</p><p> Anam&uacute; (Petiveria alliacea) grows primarily in Peru, Cuba and the southeastern United States. Folk use suggests that people with compromised immune systems may benefit from the immune-supporting properties of the anam&uacute; leaf. Historically, the leaf powder has also been used to provide support for the structural system, specifically the joints.</p><p>It has been    used as a remedy to expel parasites,     as an analgesic (pain-relieving)    and as an anti-inflammatory, particularly  for arthritis and gastritis. Amazonian    native people groups have also used this    herb    for    blood and vascular benefits.</p><p>Anamu has a long history in herbal medicine in    all of the tropical countries  where it grows. It is commonly used in big cities and towns in South and  Central America as a natural remedy to support the immune system.  Throughout Central America, Anamu is used by women to relieve birthing pains  and facilitate easy childbirth. In Guatemalan herbal medicine, a tea is  made from the leaves and drank for digestive ailments. Externally they  apply it for muscular pain and for skin problems.</p><p>Nature's      Sunshine uses only the finest quality      of pure anam&uacute; leaf. Anam&uacute; has      many active constituents, including tannins,      polyphenols, senfols and benzyl-2-hydrox-yethyl-trisulfide.      Currently, only a few companies sell      this unique herb. </p><p>  <span class="heading">The NSP (Nature's Sunshine Products) Advantage</span> <EOL> <br />  NSP gets its anam&uacute; from trusted  sources in Peru where the locals refer   to it as &quot;<i>mucura hembra</i>.&quot; Those seeking  its benefits should take caution to obtain    their anam&uacute; from a trusted source,  as does Nature's Sunshine. </p><p>&quot;Ours     is the only brand of anam&uacute; that    has been scientifically identified and     certified as mucura hembra anam&uacute;,&quot; said     Dr. Alvin Segelman, Vice President  of     NSP Health Sciences.</p><p><span class="heading">How Does      It Work?</span> <EOL><br /> <EOL>Little scientific or clinical research has been done on anam&uacute;, but its active constituents appear to provide protection to cells. Folk use suggests that this protection offers support for the immune system. </p><p>     <span class="heading">Ingredients</span> <EOL> <br />      Each capsule contains 400      mg of    anam&uacute; leaf powder. </p><p>        <span class="heading">Recommended Use</span> <EOL> <br />          For optimal benefits, take one          capsule with a meal three times          daily. </p> <EOL>
1198-4|<p align="left">The stresses of modern-day living can easily unbalance the delicate <span class="boldblack"><a href="/pages.php?pageid=7">digestive system</a></span>, bringing unpleasant side-effects. Two such effects are excessive gas and bloating. One of the causes is swallowing air with a hurried meal, since eating while under emotional tension tends to &quot;lock up&quot; the whole digestive mechanism, and the food may begin to spoil in an environment in which millions of bacteria can multiply out of control. people, especially as they age, make less and less, especially if they are using antacids. A prime suspect in <span class="boldblack"><a href="/product.php?productid=199">stomach ulcers</a></span> is a stomach-invading bacteria. Attacking the bacteria gets to the root of the problem. Acid reflux is a common health problem with stress at its roots. If one chooses not to deal with the stress they will need digestive support with formulas for <span class="boldblack"><a href="/product.php?productid=536">acid reflux</a></span>.</p> <EOL> <EOL><p align="left"><span class="boldblack">Anti-Gas Formula</span> is designed as a safe food to encourage good digestion, rather than being a drug. The formula is not designed to address everyone's stomach problems, including ulcers. Nevertheless, it is made of certain herbs that have been found to assist the body in stabilizing a digestive system with minor upsets and flatulence. Following are some of the helpful characteristics of these herbs in this popular formula:</p><p align="left"><span class="boldblack_italic">Papaya fruit</span> contains proteolytic enzymes that enhance protein digestion. It has long been used in many countries for indigestion, flatulence, nausea and belching.</p><p align="left"><span class="boldblack_italic">Ginger root</span> contains aromatic compounds that increase the production of digestive fluids and enzymes. It is an excellent natural source of trace minerals like silicon, magnesium and manganese.</p><p align="left"><span class="boldblack_italic">Peppermint leaves</span> also contain aromatic compounds that increase the production of digestive fluids, and work with the nervous and circulatory system.</p><p align="left"><span class="boldblack_italic">Wild yam root</span> contains bitter compounds that are important to the glandular system and the hormone balance that affects digestion and other body functions.</p><p align="left"><span class="boldblack_italic">Fennel seed</span> contains aromatic compounds that help stimulate the production of digestive fluids and that also work well with the urinary and respiratory systems.</p><p align="left"><span class="boldblack_italic">Dong quai root</span> smells wonderful and, along with soothing the nervous system helps increase the production of digestive fluids. It also contains bitter compounds that help regulate stored energy (glycogen) in the liver.</p><p align="left"><span class="boldblack_italic">Spearmint leaves</span> are similar to peppermint, and  help increase the production of digestive fluids and enzymes, and also work  with the nervous and circulatory systems.</p><p align="left"><span class="boldblack_italic">Catnip herb</span> helps to calm the nervous system and works well with the action of the mints.</p><p align="left"><span class="boldblack_italic">Lobelia herb</span> is a powerful relaxant of which the  effects can be felt all over the body. </p>
1018-9|<p><!-- begin mailer -->Chinese Anti-Gas is a formula combining 15 herbs. Its Chinese name 'xiao dao' can be translated to &ldquo;clear the congestion.&rdquo; It supports both the digestive and detoxifying functions of the body, including the urinary system. <!-- end mailer --></p>  <p><span class="heading">Ingredients</span><br />    The primary herbs in Anti-Gas are gastrodia, agastache, crataegus and hoelen. Under Chinese philosophy, this formula is designed to move energy to the head and support the natural elimination of excess moisture and toxins. Anti-Gas contains:</p>  <p>Proprietary blend of the following herbs.</p>  <p>Agastache tops (Agastache rugosa)</p>  <p>Crataegus fruit (Crataegus pinnatifida)</p>  <p>Hoelen sclerotium (Poria cocos)</p>  <p>Magnolia bark (Magnolia liliflora and officinalis)</p>  <p>Oryza fruit (Oryza sativa)</p>  <p>Shen-chu whole plant (Xanthium stramonium)</p>  <p>Citrus peel (Citrus aurantium)</p>  <p>Gastrodia rhizome (Gastrodia elata)</p>  <p>Ginseng root (Panax ginseng)</p>  <p>Typhonium rhizome (Typhonium flagelliforme)</p>  <p>Atractylodes rhizome (Atractylodes lancea)</p>  <p>Cardamon fruit (Amomum villosum)</p>  <p>Platycodon root (Platycodon grandiflorum)</p>  <p>Ginger rhizome (Zingiber officinale)</p>  <p>Licorice root (Glycyrrhiza uralensis)</p>  <p><span class="heading">Recommended Usage</span><br />      Take 3 capsules with a meal three times daily.</p>    <EOL><p class="boldred">NOTE: Pregnant or lactating women should consult their health <EOL>care provider prior to taking this supplement.</p>

Open in new window

0
Comment
Question by:sharingsunshine
  • 6
  • 3
9 Comments
 
LVL 30

Expert Comment

by:Marco Gasi
ID: 39804456
PHP_EOL is a constant which means End Of Line: using it, Php will use the right symbol to break lines accordingly to the actual platform. What is the platform you're working on?
0
 

Author Comment

by:sharingsunshine
ID: 39804480
The csv file will be uploaded into a Linux platform.  So can I use the .csv file with the <EOL> in it?
0
 
LVL 30

Expert Comment

by:Marco Gasi
ID: 39804507
Yes. But you can also replace in the script PHP_EOL with "\n" which is the end-of-line symbol on Linux.

But I have some question: the input and the output you have shown above are different... and in the input there are <EOL> tag yet, so I what is the real origin of those tags?
0
 

Author Comment

by:sharingsunshine
ID: 39804517
I am switching from one shopping cart to a new one.  The old one has those tags.  With all the content I have added to the new cart none of it had the <EOL> tags.  So that's why it caught me by surprise.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 30

Expert Comment

by:Marco Gasi
ID: 39804574
Take a look here: http://eetest.delphicoding.com/sharingsunshine.php

That means if you simply get your csv from repository and display it ina web page is perfectly formatted.
0
 
LVL 30

Accepted Solution

by:
Marco Gasi earned 500 total points
ID: 39804595
But if you need or want remove those <EOL> tags you can use this:

$str = "1693-4|<p><span class=\"heading\">Benefits</span><br /> <EOL> <EOL>    &bull; Nourishes the digestive and intestinal systems.<br /> <EOL>    &bull; Soothes internal tissues of the digestive and intestinal tracts.<br /> <EOL>    &bull; Contains vitamins, minerals and other important nutrients.<br /> <EOL>    &bull; Supports intestinal health.";
$newstr = htmlspecialchars(preg_replace("/\<EOL\>/", "", $str));
echo $newstr;

Open in new window


which outputs:

1693-4|<p><span class="heading">Benefits</span><br /> &bull; Nourishes the digestive and intestinal systems.<br /> &bull; Soothes internal tissues of the digestive and intestinal tracts.<br /> &bull; Contains vitamins, minerals and other important nutrients.<br /> &bull; Supports intestinal health.
0
 

Author Comment

by:sharingsunshine
ID: 39804619
That's great, thanks for your help.
0
 
LVL 30

Expert Comment

by:Marco Gasi
ID: 39804624
Add before your code above this function:

function removeTags($el) 
{
    return htmlspecialchars(preg_replace("/\<EOL\>/", "", $el));
}

Open in new window


Then replace the line 28 with this one:

file_put_contents(getcwd().'/result.csv', implode(PHP_EOL, array_map("removeTags", $data) ) );
0
 
LVL 30

Expert Comment

by:Marco Gasi
ID: 39804636
Thanks for points, sharingsunshine, and good luck with your project.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now