dificaulty for clean quotes

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Sat Sep 21, 2013 1:43 pm

dificaulty for clean quotes

Postby esteftaats » Sat Sep 21, 2013 1:46 pm

Hi guys.

I was wrote this script.

but I have a dificulty in this script.

Code: Select all

$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){
//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);
            $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() );
                    echo"database not found";
                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.

Return to “PHP coding => General”

Who is online

Users browsing this forum: Bing [Bot] and 6 guests