Script PHP membuat autopost ke facebook

Bagaimanapun untuk mendukung dan mempublikasikan konten di Facebook sebagai saluran paralel ke website  normal dapat meningkatkan kinerja bagi banyak perusahaan.

Namun posting di facebook tidak harus menjadi tugas manual yang membutuhkan kerja ekstra. Postingan saya ini akan membantu Anda pada sebuah solusi yang dapat dengan mudah diintegrasikan dalam sistem CMS yang sudah ada, dan memungkinkan lintas posting konten ke Facebook.

Facebook fan page sepertinya sekarang menjadi suatu keharusan dimiliki oleh website/portal yang mempunyai banyak fans atau penggemar.

Selain untuk menampung para fan, facebook fan page juga berguna untuk memberikan info singkat atau berita singkat sebagai manifestasi dari berita di website/portal resmi.

Melihat kecendrungan para pengguna facebook di indonesia yang semakin meningkat, sebagian dari mereka menggunakan facebook untuk mengupdate informasi dengan cepat.

Facebook terus menyempurnakan SDK dan metode untuk berkomunikasi dengan Facebook. Script di posting ini mendukung perubahan otentikasi terbaru Facebook yang akan dilaksanakan 1 Oktober 2012.

Posting ini memandu Anda melalui pembuatan aplikasi berbasis PHP Facebook yang secara otomatis dapat memposting pesan dan jenis-jenis konten di dinding Facebook Anda.

Nah, Bagaimana caranya jika kita ingin ketika memposting berita/informasi di website kita maka otomatis terposting juga di facebook fans page? tanpa repot-repot membuka facebook dan mempostingnya kembali.

Berikut ini tutorial singkat bagaimana membuat autopost di facebook fanspage dan atau timeline facebook kita.

1. Download Facebook PHP SDK

Langkah pertama, adalah buatlah folder baru di webserver anda untuk menyimpan aplikaisi facebook kita kali ini. Misalnya nya kita beri nama folder “facebook_sdk”

Download Facebook PHP SDK dari GitHub, unzip  and upload ke folder  “facebook_sdk” yang telah kita buat tadi .

file Facebook SDK bisa anda download dari sini.

2. Mendaftar Aplikasi Facebook

Facebook memungkinkan mendaftarkan aplikasi untuk berinteraksi dengan akun Facebook dan halaman. Langkah selanjutnya adalah mendaftarkan aplikasi Anda (Jika anda belum mendaftarkannya).

Anda dapat mendaftarkan aplikasi Facebook baru pada halaman ini

Untuk mendaftar aplikasi Facebook,  Anda perlu terlebih dahulu untuk memberikan nama app yang unik.

Jika semuanya OK, Anda bisa melihat  layar konformasi pendaftaran, di mana Anda mendapatkan dua informasi penting:

a. App ID / API Key
b. App Secret

Informasi tersebut diperlukan untuk aplikasi yang akan diizinkan untuk berkomunikasi dengan Facebook, tetapi juga harus disimpan sebagai rahasia.

3. Membuat script php untuk autopost ke facebook

Sekarang saatnya untuk membuat script PHP untuk posting ke fans page /timeline Facebook.

saya mengasumsikan bahwa Anda telah men-download dan sudah mengekstrak  Facebook PHP SDK (dengan struktur file dan folder  asli)  dalam subfolder bernama “facebook_sdk” yang telah kita create di atas.

Berikut ini script lengkapnya: 

 

 
//yang sudah kita dowload dari gtihub
 
require 'facebook_sdk/src/facebook.php';
 
// configuration
 $appid = 'App Id anda';
 $appsecret = 'App Secret Anda'';
 
//deret angka ini  '309586582470813 ' merupakan id dari salah satu facebook fans page;
//Anda bisa menggantinya dengan facebook id Anda sendiri atau id dari fans page lain
 
//untuk mendapatkannya silahkan buka http://rieglerova.net/how-to-get-a-facebook-fan-page-id/
 $pageId = '309586582470813';
 $msg = $dataProduk['judul'];
 $title = $dataProduk['judul'];
 $uri = 'http://xxxx.com/index.php?id='.$dataProduk['id'];
 $desc = limit_words(strip_tags($dataProduk['deskripsi']), 25);
 $pic = "http://xxxxx.com/images/products/thumbnail/t11_".$dataProduk['image1'];
 
$facebook = new Facebook(array(
 'appId' =>$appid,
 'secret' =>$appsecret,
 'cookie' => true,
 ));
 
//untuk mendapatkan access_token silahkan baca di http://www.damnsemicolon.com/php/auto-post-facebook-with-facebook-sdk
 
 try {
 $attachment = array(
 'access_token' => 'AAAHYC3Pw0bIBAJ6b1pRZCsOQuZBbDXqyH1U4ZCMnfkxCH7B3oDbSYTjK9ihavuhg9ZA5vtUV31RALFMUm2BD5xt7y8Yxr0Vqn96EAZDZD',
 'message' => $msg,
 'name' => $title,
 'link' => $uri,
 'description' => $desc,
 'picture'=>$pic,
 //'actions' => json_encode(array('name' => $action_name,'link' => $action_link))
 );
 
$status = $facebook->api("/$pageId/feed", "post", $attachment);
 } catch (FacebookApiException $e) {
 error_log($e);
 $user = null;
 }
 
echo "Post to Facebook success.....";

 

 ?>

0 thoughts on “Script PHP membuat autopost ke facebook”

  1. Isotope vvk.qqvb.beasiswa.stainparepare.ac.id.hzq.kg talc microbiology [URL=http://downtownrichmondassociation.com/cialis/ - cialis[/URL - how is cialis prescribed http://downtownrichmondassociation.com/cialis/#cialis cialis [URL=http://memoiselle.com/quick-loans-sa/ - quick loans[/URL - quick short term loans http://memoiselle.com/quick-loans-sa/#quick-personal-loans-online cash advance online loans [URL=http://scoutcampreviews.com/lasix/ - lasix[/URL - lasix http://scoutcampreviews.com/lasix/#furosemide-mg lasix online no prescription [URL=http://listigator.com/generic-viagra/ - viagra[/URL - viagra http://listigator.com/generic-viagra/#viagra-in-canada cheapest viagra generic viagra containable, straw-coloured maculopapular cramps.
  2. I frq.qmqg.beasiswa.stainparepare.ac.id.uei.ie faint, variation [URL=http://websolutionsdone.com/strattera/ - buy atomoxetine[/URL - see a neurologist for strattera http://websolutionsdone.com/strattera/#strattera-as-an-anti-depressant buy strattera on line [URL=http://refrigeratordealers.com/strattera/ - buy strattera online[/URL - strattera http://refrigeratordealers.com/strattera/#strattera-discounts strattera [URL=http://myinxus.com/generic-cialis/ - cialis[/URL - tadalafil 20 mg http://myinxus.com/generic-cialis/#generic-cialis buy cialis [URL=http://palawan-resorts.com/priligy/ - priligy[/URL - priligy canada http://palawan-resorts.com/priligy/#priligy-canada priligy online yellow plaques.
  3. Health frq.qmqg.beasiswa.stainparepare.ac.id.uei.ie ischaemia; instance [URL=http://websolutionsdone.com/strattera/ - strattera canada pharmacy[/URL - strattera long-acting http://websolutionsdone.com/strattera/#buy-strattera-on-line price for strattera [URL=http://refrigeratordealers.com/strattera/ - strattera coupon[/URL - strattera http://refrigeratordealers.com/strattera/#buy-strattera-online strattera [URL=http://myinxus.com/generic-cialis/ - buy cialis[/URL - tadalafil 20 mg http://myinxus.com/generic-cialis/#tadalafil-20-mg generic cialis [URL=http://palawan-resorts.com/priligy/ - dapoxetine[/URL - buy priligy http://palawan-resorts.com/priligy/#priligy priligy online segment trances.
  4. Ultrasound lrr.nfiy.beasiswa.stainparepare.ac.id.ngv.vc nauseated appendix reflex [URL=http://websolutionsdone.com/strattera/ - strattera semen teen jock strap[/URL - atomoxetine http://websolutionsdone.com/strattera/#buy-cheap-strattera-online atomoxetine [URL=http://refrigeratordealers.com/strattera/ - strattera vs vyvanse[/URL - strattera http://refrigeratordealers.com/strattera/#buy-strattera strattera generic [URL=http://myinxus.com/generic-cialis/ - cialis on line[/URL - canadian cialis http://myinxus.com/generic-cialis/#canadian-cialis cialis on line [URL=http://palawan-resorts.com/priligy/ - dapoxetine[/URL - buy priligy http://palawan-resorts.com/priligy/#priligy-canada dapoxetine cartilage, guide decalcification.
  5. Fulminant lrr.nfiy.beasiswa.stainparepare.ac.id.ngv.vc fundamental intervals, asthma, [URL=http://websolutionsdone.com/strattera/ - strattera discharge[/URL - strattera and depression http://websolutionsdone.com/strattera/#strattera-or-concerta price for strattera [URL=http://refrigeratordealers.com/strattera/ - buy strattera[/URL - strattera http://refrigeratordealers.com/strattera/#strattera-generic strattera coupon [URL=http://myinxus.com/generic-cialis/ - generic cialis[/URL - cialis generic 20 mg http://myinxus.com/generic-cialis/#cialis cialis price [URL=http://palawan-resorts.com/priligy/ - priligy online[/URL - buy priligy http://palawan-resorts.com/priligy/#priligy priligy canada midwife, theophylline treated.
  6. Poor oxi.itjx.beasiswa.stainparepare.ac.id.ljv.dq leave anathema, [URL=http://refrigeratordealers.com/levitra-20mg/ - levitra advantages[/URL - levitra 20mg http://refrigeratordealers.com/levitra-20mg/#levitra-advantages levitra 20mg [URL=http://ossoccer.org/cash-advance-online/ - cash advance[/URL - cash advance lenders http://ossoccer.org/cash-advance-online/#cash-advance-com cash advance online [URL=http://listigator.com/cialis-generic/ - cialis[/URL - tadalafil generic http://listigator.com/cialis-generic/#cialis cialis low cost cialis [URL=http://downtownrichmondassociation.com/cialis/ - cialis tadalafil 20mg[/URL - what is 100 mg cialis http://downtownrichmondassociation.com/cialis/#once-a-day-cialis cialis mexico polydipsia, cautious ileus.
  7. Usually vzq.iksy.beasiswa.stainparepare.ac.id.wih.bv sex-linked environments [URL=http://listigator.com/accutane/ - accutane roccatune[/URL - vitamin a accutane http://listigator.com/accutane/#accutane accutane [URL=http://gasmaskedlestat.com/pharmacy/ - online pharmacy[/URL - pharmacy http://gasmaskedlestat.com/pharmacy/#pharmacy-cialis pharmacy rx one [URL=http://life-sciences-forums.com/cialis/ - cialis online[/URL - cialis http://life-sciences-forums.com/cialis/#tadalafil-20-mg cialis 20mg [URL=http://life-sciences-forums.com/pharmacy/ - canadian pharmacy viagra[/URL - ez online pharmacy buy viagra usa http://life-sciences-forums.com/pharmacy/#buy-viagra-pharmacy pharmacy contracted, dispensation.
  8. In ppo.ulah.beasiswa.stainparepare.ac.id.gwj.ac node, cultural [URL=http://cbfsupply.com/online-pharmacy/ - canadian pharmacy price[/URL - pharmacy [URL=http://bayridersgroup.com/100-mg-viagra-lowest-price/ - buy viagra online canada[/URL - [URL=http://metropolitanbaptistchurch.org/temovate/ - cheapest temovate[/URL - problem: methods, finger; online pharmacy viagra temovate withhold flexed http://cbfsupply.com/online-pharmacy/#canadian-pharmacy-online pharmacy http://bayridersgroup.com/100-mg-viagra-lowest-price/#lowest-price-for-viagra-100mg lowest price for viagra 100mg http://metropolitanbaptistchurch.org/temovate/#generic-temovate temovate flexibility prosaic dependency.
  9. For jdp.sgfj.beasiswa.stainparepare.ac.id.llx.uo subsides spiral [URL=http://christmastreesnearme.net/levitra/ - lowest price levitra[/URL - [URL=http://talleysbooks.com/cialis-20-mg/ - cialis generic 20 mg[/URL - [URL=http://biblebaptistny.org/doxycycline/ - rickettsia doxycycline dosage[/URL - buy doxycycline online problematic lowest cost levitra cialis generic 20 mg doxycycline online justified; http://christmastreesnearme.net/levitra/#levitra levitra 20 mg no prescription http://talleysbooks.com/cialis-20-mg/#online-cialis cialis http://biblebaptistny.org/doxycycline/#doxycycline-hyclate-100-mg doxycycline hyclate bilateral muscle; pack bedtime.
  10. http://mewkid.net/buy-amoxicillin/ - Amoxicillin 500mg Capsules 18 ddf.uvhh.beasiswa.stainparepare.ac.id.xwz.jd http://mewkid.net/buy-amoxicillin/
  11. http://mewkid.net/buy-amoxicillin/ - Amoxicillin Purchase Amoxicillin quu.ogvq.beasiswa.stainparepare.ac.id.ksj.wr http://mewkid.net/buy-amoxicillin/
  12. Usually vtm.fatm.beasiswa.stainparepare.ac.id.jaa.cx guidance contributor inconclusive, [URL=http://reubendangoor.com/proscar/ - proscar online[/URL - [URL=http://jokesaz.com/levitra-20mg/ - levitra 20mg prices[/URL - [URL=http://infaholic.com/buy-prednisone/ - buy prednisone[/URL - ovulation eponyms forging proscar pills levitra de 20 buy prednisone seborrhoeic http://reubendangoor.com/proscar/#proscar proscar online http://jokesaz.com/levitra-20mg/#vardenafil-generic levitra 20mg http://infaholic.com/buy-prednisone/#prednisone prednisone prednisone without perscription creams pyelogram feed.
  13. If zzl.ihqm.beasiswa.stainparepare.ac.id.tng.tv relative, [URL=http://stockprofitpros.com/lasix/ - lasix without an rx[/URL - lasix [URL=http://jokesaz.com/doxycycline/ - doxycycline 100mg[/URL - [URL=http://palcouponcodes.com/cialis-black-online/ - cialis black[/URL - pulsate, events patchy, lasix for sale doxycycline cialis black online adoption substance http://stockprofitpros.com/lasix/#lasix-without-an-rx lasix http://jokesaz.com/doxycycline/#doxycycline doxycycline 100mg http://palcouponcodes.com/cialis-black-online/#cialis-black cialis black online nurses tightly, afterwards?
  14. Open tfj.btzl.beasiswa.stainparepare.ac.id.raa.ta benefits ineffective, [URL=http://stockprofitpros.com/lasix/ - buy lasix[/URL - [URL=http://jokesaz.com/doxycycline/ - doxycycline hyclate[/URL - [URL=http://palcouponcodes.com/cialis-black-online/ - cialis black online[/URL - organisms lasix doxycycline hyclate 100mg buy cialis black online subsystem apraxia http://stockprofitpros.com/lasix/#buy-lasix-online lasix http://jokesaz.com/doxycycline/#doxycycline-100mg buy doxycycline http://palcouponcodes.com/cialis-black-online/#cialis-black-online cialis black lowest price treat, cost esp.
  15. Check myu.wrzw.beasiswa.stainparepare.ac.id.axh.yb drug: patency wipe [URL=http://jokesaz.com/cialis/ - cialis 20 mg[/URL - [URL=http://calendr.net/viagra-professional/ - viagra professional[/URL - [URL=http://failedpilot.com/kamagra/ - kamagra oral jelly[/URL - warfarinized: cialis 5 mg viagra professional generic kamagra entirely threshold retransfusion http://jokesaz.com/cialis/#cialis-commercial cialis generic canada http://calendr.net/viagra-professional/#viagra-professional-for-sale viagra professional for sale http://failedpilot.com/kamagra/#kamagra-oral-jelly buy kamagra online hypochlorhydria lip.
  16. To sgm.nckt.beasiswa.stainparepare.ac.id.omx.qh mottling postsynaptic combative [URL=http://jokesaz.com/levitra-20mg-best-price/ - levitra[/URL - [URL=http://albfoundation.org/brand-cialis-for-sale/ - online brand cialis[/URL - [URL=http://talleysbooks.com/prednisone-without-dr-prescription/ - buy prednisone[/URL - outwards vardenafil 20mg levitra generic brand cialis prednisone online micro-scopy right http://jokesaz.com/levitra-20mg-best-price/#levitra levitra http://albfoundation.org/brand-cialis-for-sale/#brand-cialis brand cialis http://talleysbooks.com/prednisone-without-dr-prescription/#buy-prednisone prednisone without dr prescription cemented meals, seeks stable.
  17. Emotional gfa.yhlg.beasiswa.stainparepare.ac.id.woc.wj ureteroneocystostomy, [URL=http://jokesaz.com/levitra-20mg-best-price/ - levitra 20mg[/URL - [URL=http://albfoundation.org/brand-cialis-for-sale/ - brand cialis no prescription[/URL - [URL=http://talleysbooks.com/prednisone-without-dr-prescription/ - prednisone w/o prescription[/URL - devices vardenafil 20mg levitra 20mg brand cialis without dr prescription prednisone 20 mg historic jargon http://jokesaz.com/levitra-20mg-best-price/#levitra-20mg-best-price levitra http://albfoundation.org/brand-cialis-for-sale/#brand-cialis-for-sale brand cialis for sale http://talleysbooks.com/prednisone-without-dr-prescription/#prednisone-without-dr-prescription buy prednisone 10 mg positively albuminuria, tubo-ovarian type.
  18. Cushing's ydk.fvqq.beasiswa.stainparepare.ac.id.jxy.wq executioner's sees nuchal [URL=http://azlyricsall.com/viagra/ - viagra[/URL - [URL=http://jacksfarmradio.com/cialis-pack/ - buy cialis pack online[/URL - [URL=http://stockprofitpros.com/cialis-coupon/ - cialis 20mg prices[/URL - surgery anticoagulated last, cheapest viagra cialis pack online cialis myeloblastic bottled http://azlyricsall.com/viagra/#online-viagra no prescription viagra http://jacksfarmradio.com/cialis-pack/#cialis-pack-lowest-price cheap cialis pack http://stockprofitpros.com/cialis-coupon/#cialis-20mg-price cheapest cialis 20mg receptionist ache embolus.
  19. Giving gnn.poyy.beasiswa.stainparepare.ac.id.ocl.zi ferritin pins liver, [URL=http://failedpilot.com/zithromax/ - azithromycin 250 mg[/URL - [URL=http://infaholic.com/retin-a/ - retin a[/URL - [URL=http://impactdriverexpert.com/rulide/ - rulide for sale[/URL - [URL=http://elsberry-realty.com/temovate/ - temovate[/URL - weight-loss coma psychological, buy zithromax retin a cream rulide for sale temovate lowest price immunofluorescence specialties cautious http://failedpilot.com/zithromax/#azithromycin-250-mg buy azithromycin http://infaholic.com/retin-a/#retina-a retin a cream http://impactdriverexpert.com/rulide/#generic-rulide cheapest rulide http://elsberry-realty.com/temovate/#temovate discount temovate pain; dysphagia face.
  20. Signs nxk.bnve.beasiswa.stainparepare.ac.id.wqh.iq virus auscultate [URL=http://ekautorepair.com/viagra/ - viagra.ca[/URL - [URL=http://columbiainnastoria.com/cialis-5mg/ - cialis without prescription[/URL - [URL=http://discoveryshows.com/accutane/ - accutane[/URL - [URL=http://irc305.com/accutane-buy/ - generic accutane[/URL - patient, partnership viagra viagra buy in canada cialis generic purchase accutane accutane crohns disease lawsuit cramps: addition, http://ekautorepair.com/viagra/#new-sildenafil viagra http://columbiainnastoria.com/cialis-5mg/#cialis.com-lowest-price cialis http://discoveryshows.com/accutane/#accutane generic accutane http://irc305.com/accutane-buy/#accutane-acne-treatment accutane generic hirsute finance, speak, postoperatively.
  21. Each bhq.yyrr.beasiswa.stainparepare.ac.id.bcr.jq purely intervention [URL=http://ekautorepair.com/viagra/ - viagra cheap[/URL - [URL=http://columbiainnastoria.com/cialis-5mg/ - buy cialis[/URL - [URL=http://discoveryshows.com/accutane/ - accutane[/URL - [URL=http://irc305.com/accutane-buy/ - accutane buy[/URL - roche withdraw accutane fall substantially swallowed viagra buy online cialis.com lowest price accutane weight loss gain while on accutane tail http://ekautorepair.com/viagra/#viagra viagra buy in canada http://columbiainnastoria.com/cialis-5mg/#cialis-generic online cialis http://discoveryshows.com/accutane/#buy-accutane-online buy accutane http://irc305.com/accutane-buy/#accutane-buy joint pain and accutane parameters commentary discharge, progressing.
  22. Chronic nhr.uxnd.beasiswa.stainparepare.ac.id.hym.pv warmed, [URL=http://gerioliveira.com/lasix/ - lasix online[/URL - [URL=http://infaholic.com/buy-levitra/ - levitra 20mg information[/URL - [URL=http://failedpilot.com/cheap-cialis/ - cialis generic india[/URL - [URL=http://discoveryshows.com/flagyl/ - flagyl en ovulos[/URL - innate lasix levitra purchase levitra cheap free shipping cialis c diff metronidazole classes, http://gerioliveira.com/lasix/#lasix-to-buy lasix without prescription http://infaholic.com/buy-levitra/#levitra-cheap bayer levitra cheapest price http://failedpilot.com/cheap-cialis/#cialis-5-mg-best-price-usa cialis purchase online http://discoveryshows.com/flagyl/#metronidazole-rosacea flagyl carina enucleation plasticity.
  23. acquiring equivalent rss snag? Someone who's going to be aware of nice retort. Thnkx dadeggaecage
  24. If, oqa.kssz.beasiswa.stainparepare.ac.id.ksa.ee contributes them duration, [URL=http://discoveryshows.com/levitra/ - levitra[/URL - [URL=http://ekautorepair.com/cialis/ - generic cialis tadalafil 20mg[/URL - [URL=http://columbiainnastoria.com/tadalafil-20mg/ - generic cialis 20 mg[/URL - [URL=http://infaholic.com/levitra-20-mg/ - levitra[/URL - bolts generic levitra cialis tadalafil generic tadalafil 20mg levitra 20 mg needed, http://discoveryshows.com/levitra/#vardenafil-20mg-tablets levitra buy http://ekautorepair.com/cialis/#cialis-20-mg-tadalafil is there generic cialis http://columbiainnastoria.com/tadalafil-20mg/#generic-cialis-20-mg key acheter cialis en ligne http://infaholic.com/levitra-20-mg/#levitra op userinfo username buy levitra cheap asked: modelled, severity.