search
Homephp教程PHP源码解析百度搜索结果link?url=

php代码

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>查询百度link?ulr=真实链接表单</title>
</head>

<body>
<?php
/*
	getrealurl 获取301、302重定向后的URL地址  by enenba.com
	@param str $url 查询
	$return str  定向后的url的真实url
 */
function getrealurl($url){
	$header = get_headers($url,1);
	if (strpos($header[0],&#39;301&#39;) || strpos($header[0],&#39;302&#39;)) {
		if(is_array($header[&#39;Location&#39;])) {
			return $header[&#39;Location&#39;][count($header[&#39;Location&#39;])-1];
		}else{
			return $header[&#39;Location&#39;];
		}
	}else {
		return $url;
	}
}
$input = &#39;<form method="get" action=""><input type="text" name="url" id="url" style="width:800px;" /><input type="submit" value="提交" /></form><body></html>&#39;;

$url = isset($_GET[&#39;url&#39;])?$_GET[&#39;url&#39;]:&#39;&#39;;
if(empty($url)) exit($input);
$urlreal = getrealurl($url);
echo &#39;真实的url为:&#39;.$urlreal;
$urlreal = ltrim($urlreal,&#39;http://&#39;);

$search = &#39;/ebac5573358cc3c0659257bfcf54([0-9a-f]+)/i&#39;;
preg_match($search,$url,$r);
$url_encode = $r[1];  unset($r);

echo &#39;<br/>密文部分为:&#39;.$url_encode.&#39;<br/>&#39;;

$urlreal_arr = str_split($urlreal);
$url_encode_arr = str_split($url_encode,2);

echo &#39;<br />&#39;;
echo $input;
?>
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)