Skip to main content
edited title
Link
Brad Dalton
  • 7k
  • 2
  • 36
  • 47

how How to add a .php file to wordpressWordPress

edited tags
Link
fuxia
  • 107.1k
  • 38
  • 255
  • 459
Tweeted twitter.com/#!/StackWordPress/status/161274254007078912
top.location.href='". $dialog_url. "'");} else{$token_url="https://graph.facebook.com/oauth/access_token?". "client_id=". $app_id. "&client_secret=". $app_secret. "&redirect_uri=". urlencode( $post_login_url). "&code=". $code;$response = file_get_contents($token_url);$params = null;parse_str($response, $params);$access_token = $params['access_token'];// POST to Graph API endpoint to upload photos$graph_url= "https://graph.facebook.com/". $album_id. "/photos?". "url=". urlencode($photo_url). "&message=". urlencode($photo_caption). "&method=POST". "&access_token=".$access_token;echo '';echo file_get_contents($graph_url);echo '';}?>
<?php /* Template Name: Upload */ ?>


<?php
  $app_id = "12345678901234567890";
  $app_secret = "12345678901234567890";
  $post_login_url = "www.mysite.com";
  $album_id = "7777";
  $photo_url = "URL";
  $photo_caption = "cool pics";

  $code = $_REQUEST["code"];

  //Obtain the access_token with publish_stream permission 
  if (!$code){ 
    $dialog_url= "http://www.facebook.com/dialog/oauth?"
      . "client_id=" .  $app_id
      . "&redirect_uri=" . urlencode( $post_login_url)
      .  "&scope=publish_stream";
    echo("<script>top.location.href='" . $dialog_url
      . "'</script>");
  } else {
    $token_url="https://graph.facebook.com/oauth/access_token?"
      . "client_id=" . $app_id
      . "&client_secret=" . $app_secret
      . "&redirect_uri=" . urlencode( $post_login_url)
      . "&code=" . $code;
    $response = file_get_contents($token_url);
    $params = null;
    parse_str($response, $params);
    $access_token = $params['access_token'];

    // POST to Graph API endpoint to upload photos
    $graph_url= "https://graph.facebook.com/" 
      . $album_id . "/photos?"
      . "url=" . urlencode($photo_url)
      . "&message=" . urlencode($photo_caption)
      . "&method=POST"
      . "&access_token=" .$access_token;

    echo '<html><body>';
    echo file_get_contents($graph_url);
    echo '</body></html>';
  }
?>
top.location.href='". $dialog_url. "'");} else{$token_url="https://graph.facebook.com/oauth/access_token?". "client_id=". $app_id. "&client_secret=". $app_secret. "&redirect_uri=". urlencode( $post_login_url). "&code=". $code;$response = file_get_contents($token_url);$params = null;parse_str($response, $params);$access_token = $params['access_token'];// POST to Graph API endpoint to upload photos$graph_url= "https://graph.facebook.com/". $album_id. "/photos?". "url=". urlencode($photo_url). "&message=". urlencode($photo_caption). "&method=POST". "&access_token=".$access_token;echo '';echo file_get_contents($graph_url);echo '';}?>
<?php /* Template Name: Upload */ ?>


<?php
  $app_id = "12345678901234567890";
  $app_secret = "12345678901234567890";
  $post_login_url = "www.mysite.com";
  $album_id = "7777";
  $photo_url = "URL";
  $photo_caption = "cool pics";

  $code = $_REQUEST["code"];

  //Obtain the access_token with publish_stream permission 
  if (!$code){ 
    $dialog_url= "http://www.facebook.com/dialog/oauth?"
      . "client_id=" .  $app_id
      . "&redirect_uri=" . urlencode( $post_login_url)
      .  "&scope=publish_stream";
    echo("<script>top.location.href='" . $dialog_url
      . "'</script>");
  } else {
    $token_url="https://graph.facebook.com/oauth/access_token?"
      . "client_id=" . $app_id
      . "&client_secret=" . $app_secret
      . "&redirect_uri=" . urlencode( $post_login_url)
      . "&code=" . $code;
    $response = file_get_contents($token_url);
    $params = null;
    parse_str($response, $params);
    $access_token = $params['access_token'];

    // POST to Graph API endpoint to upload photos
    $graph_url= "https://graph.facebook.com/" 
      . $album_id . "/photos?"
      . "url=" . urlencode($photo_url)
      . "&message=" . urlencode($photo_caption)
      . "&method=POST"
      . "&access_token=" .$access_token;

    echo '<html><body>';
    echo file_get_contents($graph_url);
    echo '</body></html>';
  }
?>
added 1494 characters in body
Source Link
Felix
  • 333
  • 2
  • 5
  • 11
Loading
added 1494 characters in body
Source Link
Felix
  • 333
  • 2
  • 5
  • 11
Loading
Source Link
Felix
  • 333
  • 2
  • 5
  • 11
Loading