cleaning data and removing brackets
Okay I have been having a little issue with the code below right now it
pulls a bunch of data about a few stocks for me but I cant seem to get
ride of the [ or ]. I thought it would be easy to remove the brackets by
adding them to the end and the beginning of the preg_split but right when
I do it just pops a error message.
Is there any command to remove all [ or all ] cause I know I have found a
command in the past to remove all non numeric characters thank you so much
btw
<?php
$Bloomberg = 'http://www.bloomberg.com/quote/AAPL:US';
$Bloomberghtml = file_get_contents($Bloomberg);
$BloombergStart = preg_split('/data_values":/',$Bloomberghtml);
$BloombergRawData = preg_split('/>/',$BloombergStart[1]);
$OpenTimeStart = preg_split('/exch_open_time":/',$BloombergRawData[0]);
$OpenTime = preg_split('/,"/',$OpenTimeStart[1]);
$CloseTimeStart = preg_split('/exch_close_time":/',$BloombergRawData[0]);
$CloseTime = preg_split('/,"/',$CloseTimeStart[1]);
$StartPriceData = preg_split('/,/',$BloombergRawData[0]);
echo $BloombergRawData[0];
echo "<br><br><br>";
echo $OpenTime[0];
echo "<br>";
echo $CloseTime[0];
echo "<br>";
print_r($StartPriceData);
?>
No comments:
Post a Comment