Hi guys.
I was wrote this script.
but I have a dificulty in this script.
<?php require_once("simple_html_dom.php"); $post = ""; $html = file_get_html('http://www.irannaz.com/news_detail_26481.html'); $divs = $html->find("div[class=news_detail_text]"); foreach($divs as $div){ $post=$post.$div; } //echo $post; function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } $post = clean($post); $db = mysql_connect("localhost","root",""); mysql_query("SET NAMES 'utf8'", $db); mysql_query("SET CHARACTER SET utf8", $db); mysql_query("SET CHARACTER_SET_CONNECTION=utf8", $db); if ($db) { $sdb = mysql_select_db('wp',$db); if($sdb) { $sql = "INSERT INTO wp_posts (post_title,post_content,post_name,post_date,post_date_gmt,post_modified,post_modified_gmt,post_author,post_status) VALUES ('title2','".$post."','post_name2',now(),now(),now(),now(),1,'draft')"; $result = mysql_query($sql, $db)or die( mysql_error() ); } else { echo"database not found"; } } else { echo"not connected to mysql"; } $cdb = mysql_close($db); ?>
once I insert $post in databas, I see post_content field is blank because get_magic_quotes_gpc() is not work in high version of php.
I want to Solution for this dificaulty.
very tnx.