I have this below php script. I wants to add call function using curl. How to i write curl on my below script?
I am new in programming. I am still learning it goodly. Please check my code and try to help me adding curl.
My script has not error. Just i wants to add php function replace to curl function.
I hope so, you understand. Sorry for my not good English. thanks
My code is here:
$url = 'https://web.facebook.com/'.$pageid.'/videos/'.$id.'/'; $context = [ 'http' => [ 'method' => 'GET', 'header' => "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.47 Safari/537.36", ], ]; $context = stream_context_create($context); $data = file_get_contents($url, false, $context); function cleanStr($str) { return html_entity_decode(strip_tags($str), ENT_QUOTES, 'UTF-8'); } function hd_finallink($curl_content) { $regex = '/hd_src_no_ratelimit:"([^"]+)"/'; if (preg_match($regex, $curl_content, $match)) { return $match[1]; } else {return;} } function sd_finallink($curl_content) { $regex = '/sd_src_no_ratelimit:"([^"]+)"/'; if (preg_match($regex, $curl_content, $match1)) { return $match1[1]; } else {return;} } $hdlink = hd_finallink($data); $sdlink = sd_finallink($data); if ($sdlink || $hdlink) { echo '<a href="'.$hdlink.'" download="hd.mp4" class="link">HD Download </a>'; echo '<a href="'.$sdlink.'" download="sd.mp4" class="link">SD Download </a>'; } else { echo 'Download not showing - Please Reload This Page'; }