Ejemplo n.º 1
0
function hs_create_tumblr_photo_post($client, $tumblr_blog_name, $post_image = "")
{
    $tumblr_error = "";
    $listing_data = array("type" => "photo", "caption" => hs_get_auto_post_title() . ". " . hs_get_auto_post_description(), "link" => hs_get_auto_post_url(), "source" => hs_get_auto_post_photo_url());
    $listing_data["source"] = hs_get_auto_post_photo_url("small");
    try {
        $client->createPost($tumblr_blog_name, $listing_data);
    } catch (Exception $e) {
        $tumblr_error = hs_log_tumblr_error($listing_data, $e);
    }
    return $tumblr_error;
}
Ejemplo n.º 2
0
function hs_auto_post_to_facebook()
{
    $facebook = hs_get_facebook_client();
    $listing_data = ["link" => hs_get_auto_post_url(), "message" => hs_get_auto_post_title() . ". " . hs_get_auto_post_description(), "picture" => hs_get_auto_post_photo_url()];
    try {
        // Returns a 'Facebook\FacebookResponse' object
        $response = $facebook->post("/silverhoneymedia/feed", $listing_data, "YYYYYYYYYYYYYYYYYYYYYYYYY");
        // Place your Facebook Page link and Access token.
    } catch (Facebook\Exceptions\FacebookResponseException $e) {
        error_log("Facebook Graph returned an error: " . $e->getMessage(), 3, "error.log");
    } catch (Facebook\Exceptions\FacebookSDKException $e) {
        error_log("Facebook SDK returned an error: " . $e->getMessage(), 3, "error.log");
    }
}