• 20-02-2013, 23:48:19
    #1
    Yapmak istediğim ilk önce wordpres blog sitesine giriş yapsın , daha sonra yeni yazı kısmından yazı eklesin.Ama Bir türlü beceremedim.Bunu beceremediğim için aşağıda da görüldüğü gibi wp-admin başlangıç sayfasındaki QuickPress e ekleyeyim dedim ama yine olmadı nerede yanlış yapıyorum acaba ?
    <?
    
    function baglan($url,$ref = 'http://www.wordpressite.com/')
    {
    $username="wpkullanıcıadı";
    $password="wpsifreniz";
    
    $cookie=dirname(__FILE__).'/cookies.txt';
    
    $postdata = "log=". $username ."&pwd=". $password ."&wp-submit=Log%20In&redirect_to=". $url ."wp-admin/&testcookie=1";
    $postdatam = "post_title=basligim&content=aciklamam&tags_input=etim&action=post-quickpress-publish&post_type=post&_wp_http_referer=". $url ."/wp-admin/index.php";
    //$postdatam = "post_title=basligim&content=aciklamam&tags_input=etim&action=post-quickpress-publish&post_ID=795&post_type=post&_wpnonce=971f24eede&_wp_http_referer=". $url ."wp-admin/";
    
    
    //$postdata1 = "log=". $username ."&pwd=". $password ."&wp-submit=Giri%C5%9F&redirect_to=". $url ."wp-admin/post-new.php/&testcookie=1";
    $ch = curl_init();
    curl_setopt ($ch, CURLOPT_URL, $url . "wp-login.php");
    curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
    curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
    curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch,CURLOPT_COOKIEJAR,$cookie);
    curl_setopt($ch,CURLOPT_COOKIEFILE,$cookie);
    
    curl_setopt ($ch, CURLOPT_REFERER, $url . "wp-admin");
    curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
    curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdatam);
    //curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata1);
    curl_setopt ($ch, CURLOPT_POST, 1);
    $konu_ici=curl_exec($ch);  
    curl_close($ch);
    return $konu_ici;
    
    }
    
    
    $adres1 = "http://www.wordpressite.com/";
    $baglan1 = baglan($adres1);
    echo $baglan1;
    
    
    
    ?>
  • 21-02-2013, 20:09:11
    #2
    bilen yokmu arkadaşlar
  • 21-02-2013, 20:12:36
    #3
    Kimlik doğrulama veya yönetimden onay bekliyor.
    Bunun yerine Wordpress'in xml-rpc desteği ile yeni konu eklemenizi öneririm. Daha stabil olur.
  • 21-02-2013, 20:44:50
    #4
    Wordpresin kendi kayıt fonskiyonu var bunun için admin panele bağlanmanıza gerek yok wp_insert_post işinizi görecektir
  • 22-02-2013, 12:21:17
    #5
    amacım wordpress e konu eklemek değil de curl u düzgün şekilde öğrenmek , mesela öğrenci bilgi sistemimde farklı sayfalara geçiş yapıcak bi kod yazıorum , ama bu sayfa geçişlerinde tıkanıp kalıorm .