doujiang2812 2013-10-11 23:04 采纳率: 0%
浏览 43

如何通过抓住api php与curl删除照片帖子id facebook

i try to delete photos i have uploaded with app by php

the result of upload example :

 {"id":"429774393794352","post_id":"276744849097308_429774413794350"} 

first which one id or post_id will be use

and how to select it with php ??

and how to make order to delete it with php code by curl library

my idea is , i will store all photos ids into sql to delete it any time

my upload code i used

$file='./'.$new_string;






$args = array(
   'message' => $message,
);
$args[basename($file)] = '@' . realpath($file);
$ch = curl_init();
$url = 'https://graph.facebook.com/album id /photos?access_token='.$accsesss;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
$a1=$data = curl_exec($ch);
print_r(json_decode($data,true));
echo'<br/>';

i try

$args = array(
   'id' => '276744849097308_429774413794350',
   'access_token' => $accsesss ,


);
$ch = curl_init();
$url = 'https://graph.facebook.com/276744849097308_429774413794350?method=DELETE&access_token=$accsesss';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true); $a1=$data = curl_exec($ch);
print_r(json_decode($data,true));
echo'<br/>';

result

Array ( [error] => Array ( [message] => Invalid OAuth access token. [type] => OAuthException [code] => 190 ) ) 
  • 写回答

1条回答 默认 最新

  • dtx9931 2013-10-11 23:58
    关注
     $Curl_Session = curl_init('https://graph.facebook.com/429774393794352');
     curl_setopt ($Curl_Session, CURLOPT_POST, 1);
     curl_setopt ($Curl_Session, CURLOPT_POSTFIELDS, "method=DELETE&access_token=$masteracsess");
     curl_setopt ($Curl_Session, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($Curl_Session, CURLOPT_RETURNTRANSFER, 1);
    
     echo $a8=curl_exec ($Curl_Session);
     curl_close ($Curl_Session);
    

    thanks for your help @CBroe

    评论

报告相同问题?

悬赏问题

  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序