There is an array of links. You need to add them to the database, but first check out the report file.
public function query_page() { $data_link = array( "/orsk/doma_dachi_kottedzhi/dom_60_m_na_uchastke_5_sot._577934693", "/orsk/doma_dachi_kottedzhi/dom_130_m_na_uchastke_6_sot._754499329", "/orsk/doma_dachi_kottedzhi/kottedzh_295_m_na_uchastke_7_sot._553062836", "/orsk/doma_dachi_kottedzhi/dom_40.1_m_na_uchastke_3_sot._767494601", "/orsk/doma_dachi_kottedzhi/dom_54_m_na_uchastke_10_sot._783057977", ); $i=0; foreach ($data_link as $advert){ if ($i == 5) break; $inspection = $this->inspection($advert); //тут проверяем из файла-отчета if ($inspection) $this->error = true; else $this->error = false; if (!$this->error) { $mas_save["link"] = $advert; $db_query = forming_db_query_indexmas("db_advert", $mas_save, "new", "id_advert"); $q_ident = obr_db_query($db_query); //пишем в базу } $i++; sleep(9); } } private function inspection($link) { $result = false; $text_inspection = file_get_contents("result.txt"); $text_inspection = explode("\n", $text_inspection); //получаем массив ссылок из файла отчета if (sizeof($text_inspection) > 0) { foreach ($text_inspection as $get_link){ if ($get_link == $link) { $result = true; break; } } } return $result; } At the moment I have already in the report file the first 3 links from the array. The last 2 must be added, but not added. I get an error with the database. I have to sleep for up to 5 seconds and everything works fine. Tell me, what's the problem?
query_pagemethod lacks one curly bracket that would close the method body. 3. Why is theresleep()at all? .. - lolbas