Skip to content

Instantly share code, notes, and snippets.

@klemenzarn
Created May 26, 2013 12:52
Show Gist options
  • Save klemenzarn/5652706 to your computer and use it in GitHub Desktop.
Save klemenzarn/5652706 to your computer and use it in GitHub Desktop.
public function uvozidrugenovice(){
$client = new nusoap_client('http://localhost:55457/Service1.asmx?wsdl', 'wsdl');
//$client->soap_defencoding = 'UTF-8';
$client->soap_defencoding = 'UTF-8';
$client->decode_utf8 = false;
$result = $client->call('parse');
$rezultat = $result['parseResult']['string'];
$st_novic = 6;
for($i = 0;$i < $st_novic; $i++){
$naslov = $rezultat[$i];
$link = $rezultat[$i+6];
$vsebina = $rezultat[$i+12];
$preveri = $this->Drugenovice->preveriNovico($naslov,$link,$vsebina);
if(empty($preveri))
$this->Drugenovice->dodajNovico($naslov,$link,$vsebina,"Rač. novice");
}
for($i = $st_novic*3;$i < $st_novic*3+$st_novic; $i++){
$naslov = $rezultat[$i];
$link = $rezultat[$i+6];
$vsebina = $rezultat[$i+12];
$preveri = $this->Drugenovice->preveriNovico($naslov,$link,$vsebina);
if(empty($preveri))
$this->Drugenovice->dodajNovico($naslov,$link,$vsebina,"Slo-tech");
}
for($i = $st_novic*6;$i < $st_novic*6+$st_novic; $i++){
$naslov = $rezultat[$i];
$link = $rezultat[$i+6];
$vsebina = $rezultat[$i+12];
$preveri = $this->Drugenovice->preveriNovico($naslov,$link,$vsebina);
if(empty($preveri))
$this->Drugenovice->dodajNovico($naslov,$link,$vsebina,"24-ur");
}
$this->set("result",$rezultat);
$this->render("index");
//$this->redirect(array("controller"=>"index","action"=>"index"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment