Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Przekierowanie aplikacji
kiepski96
post 15.08.2012, 15:54:24
Post #1





Grupa: Zarejestrowani
Postów: 233
Pomógł: 0
Dołączył: 22.02.2010

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


Chcę, aby po opublikowaniu zdjęcia w galerii facebook skrypt przekierował na dany url.
Do poniższego skryptu tuż po:

  1. $upload_photo = $facebook->api('/'.$create_album['id'].'/photos', 'post', $photo_details);}


dodałem header("Location: http://www.domena.pl/");

ale przekierowanie następuje w iframe na facebooku.

Jak zrobić, aby po wykonaniu kodu całkowicie przekierowało na moją stronę ?

Kod:
  1. <?php
  2. require 'config.php';
  3. require_once 'inc/lib/facebook.php';
  4. if(!isset($_POST['submit'])){require_once 'inc/functions.php';}
  5. require_once 'inc/fb.php';
  6. $img = 'files/img-'. $user[id] .'.jpg';
  7. if (!file_exists($img)){
  8. $x = explode('/', $user[birthday]);
  9. $dtime = rand(2020,$x[2]+100);
  10. $dtext = $t[0];
  11. require_once('img.php');
  12. $first = 1;
  13. }
  14. if(isset($_POST['submit']) || $first == 1 && $auto_share == 1){
  15. $facebook->setFileUploadSupport(true);
  16. $album_details = array(
  17. 'message'=> 'XXX
  18. '.$page_url.'?sk=app_'.$app_id,
  19. 'name'=> 'XXX'
  20. );
  21. $create_album = $facebook->api('/me/albums', 'post', $album_details);
  22. $photo_details = array(
  23. 'message'=> 'XXX
  24. '.$page_url.'?sk=app_'.$app_id
  25. );
  26. $photo_details['image'] = '@' . realpath($img);
  27. $upload_photo = $facebook->api('/'.$create_album['id'].'/photos', 'post', $photo_details);}
  28. ?>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
cv65
post 15.08.2012, 16:34:41
Post #2





Grupa: Zarejestrowani
Postów: 94
Pomógł: 9
Dołączył: 12.04.2009

Ostrzeżenie: (20%)
X----


Użyj javascript
Kod
<script> window.location = "http://nowadomena.pl" </script>


Ten post edytował cv65 15.08.2012, 16:43:02
Go to the top of the page
+Quote Post
kiepski96
post 15.08.2012, 16:40:14
Post #3





Grupa: Zarejestrowani
Postów: 233
Pomógł: 0
Dołączył: 22.02.2010

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


Ale wtedy php się wykona ?
Go to the top of the page
+Quote Post
cv65
post 15.08.2012, 16:41:25
Post #4





Grupa: Zarejestrowani
Postów: 94
Pomógł: 9
Dołączył: 12.04.2009

Ostrzeżenie: (20%)
X----


to daj to w echo przed ?>
Go to the top of the page
+Quote Post
kiepski96
post 15.08.2012, 17:31:03
Post #5





Grupa: Zarejestrowani
Postów: 233
Pomógł: 0
Dołączył: 22.02.2010

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


Zrobiłem tak jak poniżej i nadal strona otwiera się w iframe na facebooku, zamiast przekierować.
  1. <?php
  2. require 'config.php';
  3. require_once 'inc/lib/facebook.php';
  4. if(!isset($_POST['submit'])){require_once 'inc/functions.php';}
  5. require_once 'inc/fb.php';
  6. $img = 'files/img-'. $user[id] .'.jpg';
  7. if (!file_exists($img)){
  8. $x = explode('/', $user[birthday]);
  9. $dtime = rand(2020,$x[2]+100);
  10. $dtext = $t[0];
  11. require_once('img.php');
  12. $first = 1;
  13. }
  14. if(isset($_POST['submit']) || $first == 1 && $auto_share == 1){
  15. $facebook->setFileUploadSupport(true);
  16. $album_details = array(
  17. 'message'=> 'XXX
  18. '.$page_url.'?sk=app_'.$app_id,
  19. 'name'=> 'XXX'
  20. );
  21. $create_album = $facebook->api('/me/albums', 'post', $album_details);
  22. $photo_details = array(
  23. 'message'=> 'XXX
  24. '.$page_url.'?sk=app_'.$app_id
  25. );
  26. $photo_details['image'] = '@' . realpath($img);
  27. $upload_photo = $facebook->api('/'.$create_album['id'].'/photos', 'post', $photo_details);}
  28. echo '<script>
  29. document.location="XXX";
  30. </script>';
  31. ?>


Problem rozwiązany !
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 Wersja Lo-Fi Aktualny czas: 14.08.2025 - 03:55