Home > Backend Development > PHP Tutorial > php get stock data

php get stock data

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-08-08 09:06:34
Original
2151 people have browsed it

$stock_string="http://hq.sinajs.cn/list=sh601006";
echo file_get_contents($stock_string);
?>

Get the output:
var hq_str_sh601006="Daqin Railway,6.100,6.120,6.110,6.140,6.090,6.100,6.110,20493711,125311065.000,894866,6.100,986200,6.090, 1065300,6.080,596400,6.070,912000,6.060, 122486,6.110,1106900,6.120,1318700,6.130,1221000,6.140,1334900,6.150,2016-08-05,15:00:00,00";
Use PHP to complete
1. How to extract the string
"Da Qin Railway,6.100,6.120,6.110,6.140,6.090,6.100,6.110,20493711,125311065.000,894866,6.100,986200,6.090,1065300,6.080,596400,6.070,9 12000,6.060,122486,6.110,1106900,6.120,1318700, 6.130,1221000,6.140,1334900,6.150,2016-08-05,15:00:00,00"
2. Use an array to hold this string?

Reply content:

$stock_string="http://hq.sinajs.cn/list=sh601006";
echo file_get_contents($stock_string);
?>

Get the output:
var hq_str_sh601006="Daqin Railway,6.100,6.120,6.110,6.140,6.090,6.100,6.110,20493711,125311065.000,894866,6.100,986200,6.090, 1065300,6.080,596400,6.070,912000,6.060, 122486,6.110,1106900,6.120,1318700,6.130,1221000,6.140,1334900,6.150,2016-08-05,15:00:00,00";
Use PHP to complete
1. How to extract the string
"Da Qin Railway,6.100,6.120,6.110,6.140,6.090,6.100,6.110,20493711,125311065.000,894866,6.100,986200,6.090,1065300,6.080,596400,6.070,9 12000,6.060,122486,6.110,1106900,6.120,1318700, 6.130,1221000,6.140,1334900,6.150,2016-08-05,15:00:00,00"
2. Use an array to hold this string?

This is the JS code obtained, you can try it

$stock_string="http://hq.sinajs.cn/list=sh601006";
$str = file_get_contents($stock_string);
?>
<script><br><?php echo $str; ?><br>console.log(hq_str_sh601006);<br>//TODO Process data<br></script>

Related labels:
php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template