Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> API facebook pomocy
asall
post
Post #1





Grupa: Zarejestrowani
Postów: 42
Pomógł: 0
Dołączył: 11.12.2013

Ostrzeżenie: (0%)
-----


WItam mam pytanko odnośnie przerobienia lekko tego oto skryptu

  1. <?
  2. require_once'fb/src/facebook.php';
  3.  
  4. $facebook = new Facebook(array(
  5. 'appId' => 'xxx',
  6. 'secret' => 'xxx',
  7. ));
  8.  
  9. $user = $facebook->getUser();
  10.  
  11. if ($user) {
  12.  
  13. try {
  14. $user_profile = $facebook->api('/me');
  15. $me = $facebook->api('/me');
  16. } catch (FacebookApiException $e) { $user = null; }
  17.  
  18. }
  19.  
  20. if ($user){
  21. $params = array('message' => 'x',
  22. 'access_token' => $page_access_token,
  23. 'link' => 'x',
  24. 'name' => 'x',
  25. 'caption' => 'x',
  26. 'picture' => 'x',
  27. 'description' => 'x');
  28.  
  29. $post = $facebook->api('/'.$page_id.'/feed', 'post', $params);
  30. }
  31.  
  32. ?>



wszystko działa ale publikuje na tablicy uytkownika a jak przerobić to aby publikacja byłą na stronie fanpage na facebook ?

prosze o pomoc siedzie przy tym od wczoraj szukam w google i nic
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
trueblue
post
Post #2





Grupa: Zarejestrowani
Postów: 6 806
Pomógł: 1828
Dołączył: 11.03.2014

Ostrzeżenie: (0%)
-----


A gdzie $page_id? Powinno być id strony fanpage.


--------------------
Go to the top of the page
+Quote Post
asall
post
Post #3





Grupa: Zarejestrowani
Postów: 42
Pomógł: 0
Dołączył: 11.12.2013

Ostrzeżenie: (0%)
-----


fakt nie ma bo nie wpisałem całego kodu ale spoko jest zdefiniowany ale to nie to jest problemem
Go to the top of the page
+Quote Post
trueblue
post
Post #4





Grupa: Zarejestrowani
Postów: 6 806
Pomógł: 1828
Dołączył: 11.03.2014

Ostrzeżenie: (0%)
-----


  1. $page_info = $facebook->api("/$page_id?fields=access_token");
  2. if ($user){
  3. $params = array('message' => 'x',
  4. 'access_token' => $page_info['access_token'],


lub
  1. $params = array('message' => 'x',
  2. 'access_token' => $facebook->getAccessToken(),

A tak?

Ten post edytował trueblue 22.03.2014, 15:16:09


--------------------
Go to the top of the page
+Quote Post
asall
post
Post #5





Grupa: Zarejestrowani
Postów: 42
Pomógł: 0
Dołączył: 11.12.2013

Ostrzeżenie: (0%)
-----


zadziałało dzięki kolego smile.gif to pierwsze
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.08.2025 - 07:16