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會更加穩定,非常謝謝你。能否給個代碼