<? function get_stat( $url, $headers ) { $handle = curl_init(); curl_setopt( $handle, CURLOPT_URL, $url ); curl_setopt( $handle, CURLOPT_HTTPHEADER, $headers ); curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, false ); curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, false ); curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true ); $response = curl_exec( $handle ); $code = curl_getinfo( $handle, CURLINFO_HTTP_CODE ); return array( "code" => $code, "response" => $response ); } $url_yandex_disk = "https://yadi.sk/d/swF1ayi8DGM2aQ"; $result = get_stat( "https://cloud-api.yandex.net:443/v1/disk/public/resources/download?public_key=" . urlencode( $url_yandex_disk ), array()); if( $result["code"] == 200 ) { $result["response"] = json_decode( $result["response"], true ); echo '<a class="button10" href="' . $result["response"]["href"] . '">Скачать</a> Скачать оба варианта с Яндекс диска в одном архиве'; } else { echo "error"; } ?> |
3 answers
If you want the search engine not to click on the “download” link, then add the nofollow attribute to it:
echo '<a class="button10" href="' . $result["response"]["href"] . '">Скачать</a> Скачать оба варианта с Яндекс диска в одном архиве'; But it is better to prohibit the indexing of the entire page. The easiest ways to do this:
- Add a meta tag to the page:
<meta name="robots" content="noindex">or - Add to the answer the http-header:
header('X-Robots-Tag: noindex');
- No, this is not something but the index is not nofolls exactly as I wrote it necessary. This is all I know and this is no good for me. I will not tell you why, in a nutshell, you need good site performance. There was an experience to close as you said, but for search engines it works for no exchanges! - Helpsetup
- You need these two codes together in the same language but you can, so that the actions they perform in one are Helpsetup
|
Two options, the first protection against parsa href, the second with protection against parsa on masks "http: // *". Moving in this direction, it is easy to write protection against 99% of parsers, for example, by adding / removing left symbols to links.
<a url="http://google.com" onclick="location.href=this.getAttribute('url');">link 1</a> <a url="google.com" onclick="location.href='http://'+this.getAttribute('url');">link 2</a> Well, in the php code
echo '<a class="button10" url="' . $result["response"]["href"] . '" onclick="location.href=this.getAttribute(\'url\');">Скачать</a> Скачать оба варианта с Яндекс диска в одном архиве'; |
Use the form:
<form action="http://example.com/download.php"> <a href="#" onclick="this.parentNode.submit()">Скачать</a> </form> PHP code in your case without using a template engine will be as follows:
echo '<form action="' . $result["response"]["href"] . '"><a href="#" onclick="this.parentNode.submit()">Скачать</a></form> |
<a href="url" rel="nofollow" >ytext</a>- MaximLensky<!-- noindex -->здесь ссылка<!--/ noindex -->. - MaximLensky