i need some help thats know how to change the fget function in my php to wget. Because the server not running fget. Just wget. If someone know, i will post the code line.. Thanks for answer.. Regards Leksa
'fget' is not a native PHP function. Either it's defined in your code somewhere else or you didn't write it properly here. A copy of a few lines of code and maybe a quick "this is what I'm trying to do" might help.
Well... There is fgets() : http://dk2.php.net/manual/en/function.fgets.php But post the code, and we will have a much better chance at helping you.
i used it to get CSV use fgetcsv... because i want a huge txt csv in sql table... But the server have not fget funtion in the server - that the admin said. He just pointed me to use wget, because have similar function.. How to do this? I will ad some line from the code here.. still open it.. thanks for you all reply this
if(isset($_POST['csvSubmit'])) { set_time_limit(0); $fp = fopen($dir.$_POST['csv'], "r"); $data = fgetcsv($fp, 0); for($i = 1; ; $i++) { $data = fgetcsv($fp, 0); if($data === FALSE) break; for($j = 0; $j < count($data); $j++) $data[$j] = addslashes($data[$j]); // $data[0] = "parent3^^child1^^child11^^child10"; $cats = explode("^^", $data[0]); $sql = "SELECT * FROM tblcategories WHERE CategoryName IN ('".implode("','", $cats)."') ORDER BY CategoryName"; $catList = array(); $result = mysql_query($sql); while($row = mysql_fetch_array($result)) array_push($catList, $row); //echo "<pre>".print_r($catList, true).print_r($cats, true)."</pre>"; $parent = 0; $insert = count($catList) == 0; foreach($cats as $cat) { $id = 0; if(!$insert) { $id = searchCat($catList, $cat, $parent); if($id == 0) $insert = TRUE; else $parent = $id; } if($insert) { $sql = "INSERT INTO tblcategories (CategoryName, ParentID) VALUES ('$cat', '$parent')"; mysql_query($sql);// or die(mysql_error()); $parent = mysql_insert_id(); } } $data[0] = $parent; $sql = "INSERT INTO `tblservices` (`CategoryID`, `CompanyName`, `Address`, `Country`, `PhoneContacts`, `FaxNumbers`, `WebSites`, `EmailAddress`, `ContactNameAndPosition`, `Description`, `ProductsAndServices`, `TypeOfBussiness`, `YearsInBusiness`, `Employees`, `Income`) VALUES ('".implode("','", $data)."')"; mysql_query($sql);// or die($sql."<br>".mysql_error()); if($i % 1000 == 0) echo "$i data has been inserted -- ".date('m/d/Y G:i:s')."<br>"; } echo ($i-1)." data has been inserted -- ".date('m/d/Y G:i:s')."<br><font color='green'>Complete!</font><br>"; fclose($fp); } Code (markup):