There has been a critical error on this website.
-
Hi, I added php snippet using the plugin but when I put the short code to my page, it is giving me “There has been a critical error on this website.”
Here is the php code
<?php // Web page URL $url = 'https://www.shopback.com.au/althea-cashback'; // Extract HTML using curl $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $data = curl_exec($ch); curl_close($ch); // Load HTML to DOM object $dom = new DOMDocument(); @$dom->loadHTML($data); // Parse DOM to get Title data $nodes = $dom->getElementsByTagName('title'); $title = $nodes->item(0)->nodeValue; // Parse DOM to get meta data $metas = $dom->getElementsByTagName('meta'); $description = $keywords = ''; for($i=0; $i<$metas->length; $i++){ $meta = $metas->item($i); if($meta->getAttribute('name') == 'description'){ $description = $meta->getAttribute('content'); } if($meta->getAttribute('name') == 'keywords'){ $keywords = $meta->getAttribute('content'); } } $myString = "$title"; function getBetween($content,$start,$end){ $r = explode($start, $content); if (isset($r[1])){ $r = explode($end, $r[1]); return $r[0]; } return ''; } $content = "$title"; $start = "2021 | "; $end = " Cashback"; $output = getBetween($content,$start,$end); echo $output; ?>
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘There has been a critical error on this website.’ is closed to new replies.