http://vol.stock.hexun.com/charts/close/share/info_3.ashx?code=600111
回复讨论(解决方案) 你想按什么样式写入
simxml 数据读出来后 写入数据库
每一行item的数据都要写入mysql,我刚学php,望老师给个代码,谢谢!
$con=file_get_contents(http://vol.stock.hexun.com/charts/close/share/info_3.ashx?code=600111);$xml = simplexml_load_string($con); foreach($xml->item as $v){ $arr=(array)$v->attributes(); $ar[]=$arr['@attributes']; }print_r($ar); //形成一个二维数组。插入库应该难不倒你了吧!
php code
$con=file_get_contents(http://vol.stock.hexun.com/charts/close/share/info_3.ashx?code=600111);
$xml = simplexml_load_string($con);
foreach($xml->item as $v){
$arr=(array)$v->attr……
我改了一下,用curl会更加稳定,非常谢谢你。
[quote=引用 4 楼 的回复:]
php code
$con=file_get_contents(http://vol.stock.hexun.com/charts/close/share/info_3.ashx?code=600111);
$xml = simplexml_load_string($con);
foreach($xml->item as $v){
$arr=(array)$v->attr……
我改了一下,用curl会更加稳定,非常谢谢你。能否给个代码