I have a script that serves in php 5.6, when replacing for 7 did not work.
It turns out that v4 by default is in php7, and my script is not working. What to do? Can you get back to 5.6?
I have a script that serves in php 5.6, when replacing for 7 did not work.
It turns out that v4 by default is in php7, and my script is not working. What to do? Can you get back to 5.6?
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<?php
if($_POST) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $_POST['url']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_TIMEOUT,1000);
$html = curl_exec($ch);
$h = '~<source id=\"urlVideo\".+>~';
preg_match($h, $html, $viewstate);
if (isset($viewstate[0])) {
$viewstate = $viewstate[0];
preg_match('~src="([^"]*)"~', $viewstate, $src);
if (isset($src[1])) {
$url2 = $src[1];
$ch2 = curl_init();
curl_setopt($ch2, CURLOPT_URL, $url2);
curl_setopt($ch2, CURLOPT_HEADER, TRUE);
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch2,CURLOPT_TIMEOUT,1000);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
$header = curl_exec($ch2);
$retVal = array();
$fields = explode("\r\n", preg_replace('/\x0D\x0A[\x09\x20]+/', ' ', $header));
foreach( $fields as $field ) {
if( preg_match('/([^:]+): (.+)/m', $field, $match) ) {
$match[1] = preg_replace('/(?<=^|[\x09\x20\x2D])./e', 'strtoupper("\0")', strtolower(trim($match[1])));
if( isset($retVal[$match[1]]) ) {
$retVal[$match[1]] = array($retVal[$match[1]], $match[2]);
} else {
$retVal[$match[1]] = trim($match[2]);
}
}
}
//here is the redirect
if (isset($retVal['Location'])){
$url = $retVal['Location'];
} else {
$msg = 'Não foi possível encontrar o LINK do vídeo';
}
curl_close($ch2);
} else {
$msg = 'Não foi possível encontrar o LINK do vídeo';
}
} else {
$msg = 'Não foi possível encontrar a TAG de Vídeo';
}
curl_close($ch);
if (isset($url)) {
echo '<p style="font-size: 16px; margin-top: 10px">Link encontrado: <a href="' . $url . '" target="_blank">' . $url . '</a></p>';
} else {
echo "<p class='alert alert-danger' style=\"font-size: 16px; margin-top: 10px; width: 83%\">{$msg}</p>";
}
}
?>
</div>
</div>