我正在利用这一项目。 相残:
<?php
$match_csv = fopen( matches.csv , w );
$bet_csv = fopen( bets.csv , w );
$xml = simplexml_load_file( http://xml.cdn.betclic.com/odds_en.xml );
$bookmaker = Betclick ;
foreach ($xml as $sport) {
$sport_name = $sport->attributes()->name;
foreach ($sport as $event) {
$event_name = $event->attributes()->name;
foreach ($event as $match) {
$match_name = $match->attributes()->name;
$match_id = $match->attributes()->id;
$match_start_date_str = str_replace( T , , $match->attributes()->start_date);
$match_start_date = strtotime($match_start_date_str);
if (!empty($match->attributes()->live_id)) {
$match_is_live = 1;
} else {
$match_is_live = 0;
}
if ($match->attributes()->streaming == 1) {
$match_is_running = 1;
} else {
$match_is_running = 0;
}
$match_row = $match_id . , . $bookmaker . , . $sport_name . , . $event_name . , . $match_name . , . $match_start_date . , . $match_is_live . , . $match_is_running;
fputcsv($match_csv, explode( , , $match_row));
foreach ($match as $bets) {
foreach ($bets as $bet) {
$bet_name = $bet->attributes()->name;
foreach ($bet as $choice) {
// team numbers are surrounded by %, we strip them
$choice_name = str_replace( % , , $choice->attributes()->name);
// get the float value of odss
$odd = (float)$choice->attributes()->odd;
// concat the row to be put to csv file
$bet_row = $match_id . , . $bet_name . , . $choice_name . , . $odd;
fputcsv($bet_csv, explode( , , $bet_row));
}
}
}
}
}
}
fclose($match_csv);
fclose($bet_csv);
?>
之后,将剪辑文件装入我的手法。 每天一分钟就开车,迄今为止是巨大的。