how to Extract the data from http://www.pse.com.ph/servlet/TickerServletFile save into mysql database?
This should be a code igniter based class,
The table header shoul开发者_开发知识库d be
Price Percent_change Company Name Company Code Volume
Please help any one knows?
Many thanks!
You just need to parse the file and insert it into a database. A quick look at the link shows that it seems to be all separated by semi-colons. Take a look at explode()
To get your results, simply do
$splitContents = explode($rawContents);
$counter=0
while($counter <= count($splitContents)) {
$Price=$splitContents[$counter++]
$Percent_change=$splitContents[$counter++]
$Company_Name=$splitContents[$counter++]
$Company_Code=$splitContents[$counter++]
$Volume=$splitContents[$counter++]
mysql_query("INSERT INTO ....");
}
In your codeigniter class, you should call the file_get_contents
function with specified url:
$contents = file_get_contents('url here');
Now you have data of specified url in $contents
variable that you can manipulate as you like.
精彩评论