I want to include an external file, and then get all the content, remove the only HTML on the page <br /> and replace with , and fire it into an array.
datafeed.php
john_23<br />
john_5<br />
john_23<br />
john_5<br />
grabber.php
<?php
// grab the url
include("http://site.com/datafeed.php");
//$lines = file('http://site.com/datafeed.php);
// loop through array, show HTML source as HTML source.
foreach ($lines as $line_num => $line) {
// replace the <br /> with a ,
$removeBreak = str_replace("<br />",",", $removeBreak);
$removeBreak = htmlspecialchars($line);
// echo $removeBreak;
}
// fill our array into string called SaleList
$SaleList = ->array("");
I want to load a php file from the server directory, get the HTML contents of this file and place it into a useable array.
It would look like
$SaleList = -getAndCreateArray from the file above >array("");
$SaleList = ->array("john_23, john_5, john_23");
include()on remote urls is dangerous. You're giving an external server COMPLETE control of your script, and therefore complete control of your website. Beyond that... is there a question there? You don't mention having a problem, so if this code is working fine, then why post it?$removeBreakwithout ever defining it, but without know what the OP actually wants this code to do, that could just be a bit of dead code.