开发者

how to Extract the data from http://www.pse.com.ph/servlet/TickerServletFile save into mysql database?

开发者 https://www.devze.com 2023-01-02 09:57 出处:网络
This should be a code igniter based class, The table header shoul开发者_开发知识库d be PricePercent_change Company NameCompany CodeVolume

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消