• 17-08-2020, 13:54:47
    #1
    Üyeliği durduruldu
    function Baglan($url){
    $curl=curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
    $cikti = curl_exec($curl);
    curl_close($curl);
    return str_replace(array("n","t","r"), null, $cikti);
    }
    $Baglan = Baglan('https://www.r10.net');

    include("wp-config.php");
    $title=$_POST['title'];
    $baslik=$title;


    preg_match('#<title>(.*?)" /></title>', $Baglan, $baslik);


    $my_post = array();
    $my_post['post_title'] = $baslik;
    $my_post['post_content'] = 'deneme';
    $my_post['post_status'] = 'publish';
    $my_post['post_author'] = 1;
    $my_post['post_category'] = 0;

    $the_post_id = wp_insert_post( $my_post );

    Kodları ile r10 un titlesini wordpress içeriğime çekmek istiyorum ama çekemiyorum $baslik kodu ile hiç bir şey gelmiyor. Ama print_r ($baslik); yapınca gözüküyor. Hatayı bulamadım
  • 17-08-2020, 13:56:43
    #2
    $my_post['post_category'] = array(37); yapın ek olarak
    $post_id = wp_insert_post($my_post);
    if($post_id){
    echo '<div id="content"><a>eklendi</a></div>';
    }
    else{
    echo '<div id="content"><a>hata</a></div>';
    }
    ekleyin.
  • 17-08-2020, 14:04:06
    #3
    Üyeliği durduruldu
    husamettinunal adlı üyeden alıntı: mesajı görüntüle
    $my_post['post_category'] = array(37); yapın ek olarak
    $post_id = wp_insert_post($my_post);
    if($post_id){
    echo '<div id="content"><a>eklendi</a></div>';
    }
    else{
    echo '<div id="content"><a>hata</a></div>';
    }
    ekleyin.
    Eklendiği zaman yazı başlığı "(başlıksız)" şeklinde kayıt ediyor aslında başlığın r10 un titlesi olması gerekiyor.
  • 17-08-2020, 14:13:25
    #4
    $site = file_get_contents("https://r10.net/");
    function ara($bas, $son, $yazi)
    {
    @preg_match_all('/' . preg_quote($bas, '/') .
    '(.*?)'. preg_quote($son, '/').'/i', $yazi, $m);
    return @$m[1];
    }
    $Baslik = ara('<title>','</title>', $site);
    echo $Baslik[0];
    üst tarafı "$Baglan = Baglan('https://www.r10.net'); " bölümüne kadar silin ve yukarıdaki kodu ekleyin.
    $my_post['post_title'] = $Baslik[0];
    olarak değiştirin
  • 17-08-2020, 14:14:48
    #5
    <?php
    $site = file_get_contents("https://www.shopinext.com/");
    function ara($bas, $son, $yazi)
    {
    @preg_match_all('/' . preg_quote($bas, '/') .
    '(.*?)'. preg_quote($son, '/').'/i', $yazi, $m);
    return @$m[1];
    }
    $Baslik = ara('<title>','</title>', $site);
    
    include 'wp-config.php';
    $my_post = array();
    $my_post['post_title'] = $Baslik[0];
    $my_post['post_content'] = 'deneme';
    $my_post['post_status'] = 'publish';
    $my_post['post_author'] = 1;
    $my_post['post_category'] = 0;
    
    $the_post_id = wp_insert_post( $my_post );
    
    ?>