PHP code example of kri55h / socialfork
1. Go to this page and download the library: Download kri55h/socialfork library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kri55h / socialfork example snippets
use Kri55h\SocialFork;
try {
// Instantiate SocialFork
$socialFork = new SocialFork();
// Set the URL of the post you want to download
$socialFork->setUrl('<social_media_post_url>');
// Set the path where you want to store the downloaded video
$socialFork->setDownloadPath('<path_to_store_video>');
// Set the desired name (without extension) for the downloaded video
$socialFork->setName('<name_without_extension>');
// Trigger the download process
$videoSaved = $socialFork->download();
if ($videoSaved) {
return 'Video saved!';
} else {
return 'Failed to save video.';
}
} catch (Exception $e) {
// Handle any exceptions or errors that occurred during the process
return 'An error occurred: ' . $e->getMessage();
}