[ CoaPsyFactor @ 28.05.2011. 17:14 ] @
imam problem sa sledecim kodom, sve uradi kako treba, ali kada treba da uradi file_get_contents($value['URL']) izbaci mi Warning: file_get_contents( http://www.gamespot.com/pc/rpg/thewitcher2/index.html ) [function.file-get-contents]: failed to open stream: Invalid argument in D:\xampp\htdocs\preg\index.php on line 21 i tako za svaki clan iz niza... Code: <? $query = "INSERT INTO items (Item_Category, Item_Image, Item_Title, Item_Description) VALUES "; $data = array(); for($i = 0; $i<1;$i++){ $contents = file_get_contents('http://www.gamespot.com/games....asc&official=all&page=' . $i); preg_match_all('/<th>\n <a href="http:\/\/www.gamespot.com\/(.*)\/(.*)\/(.*)\/index.html">(.*)<\/a>\n <\/th>/', $contents, $matches); foreach($matches[4] as $key => $value){ $contents_new = str_replace('<a href="', '', $matches[0][$key]); $contents_new = str_replace('</a>', '', $contents_new); $contents_new = str_replace('<th>', '', $contents_new); $contents_new = str_replace($value, '', $contents_new); $contents_new = str_replace('">', '', $contents_new); $contents_new = str_replace('</th>', '', $contents_new); $url = str_replace(' ', '', $contents_new); $cat = mt_rand(1, 4); $datas = array('URL' => $url, 'Game' => $value, 'Category' => $cat); $data[] = $datas; } } foreach($data as $key => $value){ file_get_contents($value['URL']); } ?> [Ovu poruku je menjao flylord dana 30.05.2011. u 09:28 GMT+1] |