Linux premium61.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
LiteSpeed
Server IP : 185.61.154.53 & Your IP : 216.73.216.73
Domains :
Cant Read [ /etc/named.conf ]
User : vdeshvpx
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
home /
vdeshvpx /
adminapi.linkcrow.com /
app /
Traits /
Delete
Unzip
Name
Size
Permission
Date
Action
ArticleGenerator.php
4.73
KB
-rwxrwxrwx
2024-10-27 12:35
current.php
22
B
-rw-r--r--
2026-04-01 01:39
Save
Rename
<?php namespace App\Traits; use DomDocument; use App\Models\LinkContentImage; use Illuminate\Support\Facades\Http; trait ArticleGenerator { private $apiKey = "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"; private $model = 'gpt-3.5-turbo'; private $max_tokens = 1024; private $temperature = 0.5; public function generateArticle($data) { try{ $response = Http::timeout(80)->withHeaders([ 'Authorization' => 'Bearer ' . $this->apiKey, 'Content-Type' => 'application/json' ])->post('https://api.openai.com/v1/chat/completions',[ 'model' => $this->model, 'messages' => [ [ 'role' => "system", 'content' => "You are a professional article writer. You are writing an article about ".$data['topic'] ], [ 'role' => "user", 'content' => "As an experienced article writer, generate a comprehensive, SEO-optimized article using the keyword ".$data['anchor_text'].". Use appropriate headings to make the article easy to read and understand. Article should be of atleast ".$data['word_count']." words. Return it as Structured HTML Format." ] ], 'max_tokens' => $this->max_tokens, 'temperature' => $this->temperature ]); $response->json(); if(isset($response['choices'][0]['message']['content'])){ return response()->json(['content' => $response['choices'][0]['message']['content']]); } return response()->json(['error' => $response['error']['message'], 'errorCode' => $response['error']['code'], 'errorType' => $response['error']['type']], 422); }catch(\Exception $e){ return response()->json(['error' => $e->getMessage()]); } } public function saveArticle($article, $id){ $dom = new DomDocument('1.0', 'UTF-8'); libxml_use_internal_errors(true); $dom->loadHtml($article); // Checking For Prev Images and Deleting Theme $linkContentImages = LinkContentImage::where('link_content_id', $id)->first(); if($linkContentImages && $linkContentImages->images){ $images = json_decode($linkContentImages->images, true); foreach($images as $image){ $image_path = public_path('storage/uploads/').$image; unlink($image_path); } } $images = $dom->getElementsByTagName('img'); if(count($images)){ $newImages = []; foreach ($images as $k => $img) { $data = $img->getAttribute('src'); list($type, $data) = explode(';', $data); list(,$extension) = explode('/',$type); list(,$data) = explode(',', $data); $data = str_replace( ' ', '+', $data ); $data = base64_decode($data); $image_name = 'article_' . $id . '_' .time() . '_' .$k . '.' .$extension; // Pushing Into New Array array_push($newImages, $image_name); // Saving Image to Storage $path = public_path('storage/uploads/'). $image_name; file_put_contents($path, $data); //after saving the file we will then replace the img src link to the saved directory link $img->removeAttribute('src'); $img->setAttribute('src', $image_name); }; LinkContentImage::updateOrCreate(['link_content_id' => $id],['link_content_id' => $id,'images' => json_encode($newImages)]); } $savedArticle= $dom->saveHTML(); return $savedArticle; } public function processedArticle($article){ $dom = new DomDocument('1.0', 'UTF-8'); libxml_use_internal_errors(true); $dom->loadHtml($article); $images = $dom->getElementsByTagName('img'); if(count($images)){ foreach ($images as $k => $img) { $imgSrc = $img->getAttribute('src'); $ext = substr($imgSrc, strpos($imgSrc, '.') + 1); $path = public_path('storage/uploads/').$imgSrc; $base64Path = base64_encode(file_get_contents($path)); $img->removeAttribute('src'); $img->setAttribute('src', 'data:image/'. $ext .';base64,'. $base64Path); } } $processedArticle= $dom->saveHTML(); return $processedArticle; } }