Skip to content

Instantly share code, notes, and snippets.

@rmcdaniel
Created December 6, 2022 02:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmcdaniel/b24989aadde1f1a6341fb13a17d5ecf1 to your computer and use it in GitHub Desktop.
Save rmcdaniel/b24989aadde1f1a6341fb13a17d5ecf1 to your computer and use it in GitHub Desktop.
<?php
namespace App\Workflows\BuildPDF;
use Illuminate\Support\Facades\Http;
use Workflow\Activity;
class ConvertURLActivity extends Activity
{
public function execute($url)
{
$fileName = uniqid() . '.pdf';
Http::withHeaders([
'Apikey' => 'YOUR-API-KEY-GOES-HERE',
])
->withOptions([
'sink' => storage_path($fileName),
])
->post('https://api.cloudmersive.com/convert/web/url/to/pdf', [
'Url' => $url,
]);
return $fileName;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment