2013-10-17 09:26
浏览 88

在facebook ads api中获取图像的哈希码

I'm trying to get hash image using the Facebook Ads api. I didn't understand how to make the call. I have the image Url as string and the image itself as Byte[].

This is the example from FB documentation:

curl -F 'test.jpg=@test.jpg' -F 'access_token=_' "https://graph.facebook.com/act_368811234/adimages"

What is the test.jpg=@test.jpg means ? It's not something that I've seen before.

You can find the relevant Facebook documentation URL at: https://developers.facebook.com/docs/reference/ads-api/adimage/

Thank you

图片转代码服务由CSDN问答提供 功能建议

我正在尝试使用Facebook Ads api获取哈希图像。 我不明白如何制作 电话。 我有图片网址为字符串图片本身为字节[]

这是FB的示例 文档:

curl -F'test.jpg = @ test.jpg'-F'access_token = _ '“ https://graph.facebook.com/act_368811234/dimages \ n

test.jpg = @ test.jpg是什么意思? 这不是我以前见过的。

您可以在以下网址找到相关的Facebook文档网址: https://developers.facebook.com/docs/reference/ads-api/adimage/


  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douwen7516 2013-10-18 03:10

    The following part of the curl request means post a parameter named test.jpg which references a local file path within the current directory called test.jpg.


    If you're using c#, you may want to take a look at the open source library available from facebooksdk.net (note, it's not produced by Facebook): http://facebooksdk.net/docs/making-synchronous-requests/

    Using this, it will likely be a couple of lines of code:

    var fb = new FacebookClient("access_token");
    string attachementPath = @"C:\\image.jpg";
    dynamic result = fb.Post("act_YOURACCOUNTID/adimages",
            file = new FacebookMediaObject
                ContentType = "image/jpeg",
                FileName = Path.GetFileName(attachementPath)

    As you also tagged PHP, you can use the Facebook SDK which is produced by Facebook with the following code: https://github.com/facebook/facebook-php-sdk/

    $facebook = new Facebook(array(                                                                                       
      'appId'  => 'YOUR_APPID',                                                                                      
      'secret' => 'YOUR_APPSECRET',                                                                     
    $args = array(                                                                                                        
         basename($file) => '@' . realpath($file),                                                                           
    $response = $facebook->api('/act_YOURACTID/adimages','post',$args);
    解决 无用
    打赏 举报

相关推荐 更多相似问题