php获取网页源代码并朗读
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>浏览</title>
<?php
$url=$_GET['url'];
$ch = curl_init();
$timeout = 10;
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$contents = curl_exec($ch);
$lines_string=preg_replace('/href="/','href="http://192.168.43.1:8080/web.php?url=',$contents);
echo $lines_string;
$pos = strpos($contents,'utf-8');
if($pos===false){$contents = iconv("gbk","utf-8",$contents);}
preg_match("/<body.*?>(.*?)<\/body>/is",$contents, $title);
$body= $title[1];
$a= preg_replace("/<sty(.*)\/style>|<scr(.*)\/script>|<!--(.*)-->/isU","",$body);
$b= strip_tags($a);
echo "<audio autoplay='autoplay'>
<source src='http://tts.baidu.com/text2audio?idx=1&tex=";
echo $b;
echo "&cuid=baidu_speech_demo&cod=2&lan=zh&ctp=1&pdt=1&spd=7&per=0&vol=9&pit=5' type='audio/mpeg' />";
?>
</html>
扫描二维码推送至手机访问。
本サイト上に掲載の文章、画像、写真などを無断で複製することは法律で禁じられています。全ての著作権はGAMESHに帰属します。