php - Parsing XML too slow? -


i read similar questios, don't understand how can xml data url faster?

why code runs slow:

while($id = $getfix->fetch()){      $odds=$this->soccer->getalloddsbyfixturematchid(array("fixturematch_id"=>$id['id']));     }      if(!empty($odds)){        $stmt = $this->pdo->prepare("call insupd_odds(:fixturematchid, :bookmaker, :updateddate, :type,:homeodds, :drawodds, :awayodds, :handicap)");     foreach($odds $key=>$value){        $stmt->bindparam(':fixturematchid',$value->fixturematch_id);        $stmt->bindparam(':bookmaker',$value->bookmaker);            $stmt->bindparam(':updateddate',$value->updateddate);        $stmt->bindparam(':type',$value->type);        $stmt->bindparam(':homeodds',$value->homeodds);        $stmt->bindparam(':drawodds',$value->drawodds);        $stmt->bindparam(':awayodds',$value->awayodds);        $stmt->bindparam(':handicap',$value->handicap);        $stmt->execute();     }     } 

i need list odds fixture id stored in database, need call ids database , send id's xml feeder returns me odds fixtures , store database... s running more 300 seconds , execute...

this important parser code:

public function __call($name,$params){     $data=$this->request($this->buildurl($name,$params));     if(false===($xml = simplexml_load_string($data))) throw new xmlsoccerexception("invalid xml");     if(strstr($xml[0],"to avoid misuse of service")){         switch($name){             case "getlivescore":             case "getlivescorebyleague":             case "getoddsbyfixturematchid":             case "gethistoricmatchesbyleagueandseason":             case "getallteams":             case "getallteamsbyleagueandseason":                 throw new xmlsoccerexception($xml[0],constant("self::timeout_".$name));             default:                 throw new xmlsoccerexception($xml[0],self::timeout_others);         }     }     return $xml; } 

i know main problem in xml checking id's, way can odds fixture, can use leagues, same...

thanks.

in following...

while($id = $getfix->fetch()) {    $odds=$this->soccer->getalloddsbyfixturematchid(array("fixturematch_id"=>$id['id'])); } 

it appears may querying remotely whole bunch of odds storing them in same variable. when out of loop have last set of odds collected available insert/update or other processing.

however, nice have bit more description doing, different methods expected , return, , on.

again, guessing, perhaps have date of last update on records? if so, , rely on it, first call might return records, next call might return 1 record (since looks last 1 fetched processed) , on. that's lot of fetch requests external site -- explain long execution time.

if i'm barking wrong tree please supply additional details , i'll try provide better diagnosis.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -