Posts tagged ‘curl’
PHP ile WordPress Bloga Yazı Eklemek (XMLRPC)
Çoğu zaman yazıyı elle eklemek zor oluyor heleki PHP ile sitelerinde hazır bot kullanan arkadaşlar için
İlk öncelikle yönetim panelinden Settings kısmından Writing e tıklayarak sayfanın altında XML-RPC'yi etkin etmemiz gerekiyor harici bir dosyadan veri ekleyebilmemiz için.
-
function wpPostXMLRPC($title,$body,$rpcurl,$username,$password,$category,$keywords='') {
-
-
'title'=>$title,
-
'description'=>$body,
-
'mt_allow_comments'=>1, // Yoruma izin vermek için 1 yapın
-
'mt_allow_pings'=>1, // Trackbacks için 1 yapın
-
'post_type'=>'post',
-
'mt_keywords'=>$keywords,
-
'categories'=>array($category)
-
);
-
$request = xmlrpc_encode_request('metaWeblog.newPost',$params);
-
$ch = curl_init();
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
-
curl_setopt($ch, CURLOPT_URL, $rpcurl);
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
-
$results = curl_exec($ch);
-
curl_close($ch);
-
return $results;
-
}
Bu fonksiyon daha hızlı kullanmanız için
-
$Baslik = 'BAŞLIK';
-
$Icerik = 'YAZI İÇİ';
-
$XMLPCDosyasi = 'http://www.wpsiteminadresi.com/xmlrpc.php';
-
$KullaniciAdi = 'admin';
-
$Sifre = 'kullanicisifrem';
-
$Kategoriler = 'Haber,Oyun,Spor'; // Virgüllerle ayırarak kategori isimlerini yazmanız gerekmektedir.
-
$Etiketler = 'xxx,yyy,zzz,aaa,eee,ppp,sss'; // Virgüllerle ayırarak istediğiniz kadar yazabilirsiniz.
-
Hayırlı uğurlu olsun
Unutmadan cURL sunucuda aktif olması gerekmektedir.
Sizin için hazırlamış olduğum dosyayı indirerek direkt olarak deneyebilirsiniz.
cURL & php ile FriendFeed’e kayıt girişi yapmak
friendfeed.com u bilmeyenimiz kalmadı sanırım tekrar açıklamaya gerek yoktur.
Daha önceden delicious ve twitter a curl ile yazı gönderimini işlemiştik.
Şimdide sıra friendfeed'e geldi.
İnternette aradım pek bişi bulamadım deneyerek ortaya çıktı kodlar
Friendfeed de daha öncekilerde olduğu gibi direk şifreniz ile işlem yapamıyorsunuz.
https://friendfeed.com/account/api adresinden Remote Key almanız gerekmektedir.
Ve işte kodlar;
-
$ff_api_url = "http://friendfeed-api.com/v2/entry";
-
$ff_data = "body=".$Baslik."&link=".$Linkiniz."&comment=".$Yorumu_Aciklama."&image_url=".$ResimVarsaAdresi;
-
$ff_user = "KullaniciAdiniz";
-
$ff_password = "AlmisOldugunuzRemoteKey";
-
$ch = curl_init($ff_api_url);
-
curl_setopt($ch, CURLOPT_POST, 1);
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $ff_data);
-
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
-
curl_setopt($ch, CURLOPT_HEADER, 0);
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-
curl_setopt($ch, CURLOPT_USERPWD, "{$ff_user}:{$ff_password}");
-
$twitter_data = curl_exec($ch);
-
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
-
curl_close($ch);
-
if ($httpcode != 200) {
-
echo "<strong>Friendfeed</strong> HATA<br />";
-
} else {
-
echo "<strong>Friendfeed</strong> OK<br />";
-
}
güle güle kullanımlar
cURL & php ile delicious’a otomatik yazı gönderme

Daha önce curl ile twitter'a post atma işlemini incelemiştik şimdide sıra geldi delicious'a
-
$dusername = 'KullaniciAdi';
-
$dpassword = 'Sifre';
-
-
$api = "api.del.icio.us/v1";
-
-
$apicall = "https://$dusername:$dpassword@$api/posts/add?&url=$link&description=$desc&extended=$ext&tags=$deltags";
-
$ch = curl_init();
-
curl_setopt($ch, CURLOPT_URL,$apicall);
-
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
-
curl_setopt($ch, CURLOPT_USERAGENT, 'php-curl');
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
-
$xml = curl_exec ($ch);
-
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
-
curl_close($ch);
-
if ($httpcode != 200) {
-
echo "<strong>Delicious</strong> HATA";
-
} else {
-
echo "<strong>Delicious</strong> OK";
-
}
cURL & php ile twitter’a otomatik yazı gönderme

-
$twitter_api_url = "http://twitter.com/statuses/update.xml";
-
$twitter_data = "status=Buraya Link ve Açıklama Yazabilirsiniz";
-
$twitter_user = "KullaniciAdi";
-
$twitter_password = "Sifre";
-
$ch = curl_init($twitter_api_url);
-
curl_setopt($ch, CURLOPT_POST, 1);
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $twitter_data);
-
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
-
curl_setopt($ch, CURLOPT_HEADER, 0);
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-
curl_setopt($ch, CURLOPT_USERPWD, "{$twitter_user}:{$twitter_password}");
-
$twitter_data = curl_exec($ch);
-
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
-
curl_close($ch);
-
if ($httpcode != 200) {
-
echo "Twitter HATA";
-
} else {
-
echo "Twitter OK&";
-
}
Yapmanız gereken cURL destekleyen bir sunucunuz var ise istediğiniz makale veya yazılarınızı otomatik olarak twitter hesabınıza post etmenize yardımcı olur.
Kolay Gelsin