在用户墙上发布图像,其中包含应用程序消息,然后是应用程序URL


Post image on user wall with app message followed by app URL

在我的应用程序中,我在墙上发布图像,它工作正常,但现在我的要求是打印我的应用程序的 URL 并带有消息并拥有它,以便当用户单击链接时,他被重定向到我的应用程序。

您可以使用 curl 方法,我正在使用这个并且它工作正常

$attachment =  array(
                            'access_token' => "accesstoken",
                            'caption' => "Hey -- this is caption",
                            'description' => "Your Desc",
                            'link' => "http://www.example.com/",
                            'picture'=> "path/image.png"
                        );
                        $ch = curl_init();
                        curl_setopt($ch, CURLOPT_URL,'https://graph.facebook.com/XXXXXX/feed');
                        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
                        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
                        curl_setopt($ch, CURLOPT_POST, true);
                        curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
                        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  //to suppress the curl output 
                        $result = curl_exec($ch);
                        curl_close ($ch);