I'm developing a facebook application that post on the user wall with offline permission guaranteed. I'm using PHP with the facebook api (this code is in "index.php"):
$user = $_GET['user'];
(if(isset($_GET['publish'])) {
$attachment = array(
'message' => "My message",
'link' => "http://...",
'picture' => 'my_url_picture',
'name' => "link_name",
'caption' => 'my_caption',
'description'=> 'my_description'
);
$publishStream = $facebook->api("/$user/feed", 'post', $attachment);
}
Now, I use a Java servlet that, when an event occurs, has to post on the user wall in this way:
if(event) {
Runtime rt = Runtime.getRuntime();
String url_post = "http://apps.facebook.com/myapp/index.php?publish=1&user=user_id";
rt.exec("rundll32 url.dll,FileProtocolHandler " + url_post);
}
All is ok. When the event occurs my server open the browser at the previous link and开发者_如何学Python the post appears correctly on the user (with user_id) wall. Is possible to "visit" the link without open a browser page? I'm using resin 4.0 for testing my app, Windows 7 Pro Service Pack 1 (but tested also in Windows XP). Thanks for your attention.
if i've understood you right, you don't know how to post without opening system browser. Maybe you should look for programming browser like Snoopy (http://sourceforge.net/projects/snoopy/). You can make http requst without opening anything.
You should take a look at the apache httpclient project.
精彩评论