8796 sujets
Dans le langage serveur PHP, une fonction permet de récupérer les entêtes d'un requête
http://php.net/manual/fr/function.get-headers.php
A partir du résultat tu devrais pouvoir obtenir quelque chose de intéressant.
Après si tu ne donnes pas plus d'infos, ça va être dur de cibler ton besoin , et donc difficile de répondre correctement.
http://php.net/manual/fr/function.get-headers.php
A partir du résultat tu devrais pouvoir obtenir quelque chose de intéressant.
Après si tu ne donnes pas plus d'infos, ça va être dur de cibler ton besoin , et donc difficile de répondre correctement.
bonjour
merci de m'avoir rependu aussi vite
j'ai trouver ca
<?
error_reporting(E_ALL);
// Gets everything headers and HTML
function geteverything($url) {
// Gets url ready to use
$info = @parse_url( $url );
// Opens socket
$fp= @fsockopen( $info["host"], 80, $errno, $errstr, 10 );
// Makes sure the socket is open or returns false
if ( !$fp ) {
return false ;
}
else {
// Checks the path is not empty
if( empty( $info["path"] ) ) {
// If it is empty it fills it
$info["path"] = "/";
}
$query = "";
// Checks if there is a query string in the url
if( isset( $info["query"] ) ) {
// If there is a query string it adds a ? to the front of it
$query = "?".$info["query"]."";
}
// Sets the headers to send
$out = "GET ".$info["path"]."".$query." HTTP/1.0\r\n";
$out .= "Host: ".$info["host"]."\r\n";
$out .= "Connection: close \r\n";
$out .= "User-Agent: link_checker/1.1\r\n\r\n";
// writes the headers out
fwrite( $fp, $out );
$html = '';
// Reads what gets sent back
while ( !feof( $fp ) ) {
$html .= fread( $fp, 8192 );
}
// Closes socket
fclose( $fp );
}
return $html;
}
/////// End of Gets everything headers and HTML ////////////////
?>
et en appel a cet fonction mais je sais pas ou n'est ou mettre ce code :
<?php require("url_check.php")
$html = geteverything($url);
if(!$html){
//header("Location: introuvable.php?stat=error");
}
else {
// Get status code
$remove=0;
switch ($id_players){
case 4:
$stripZ=explode("X-Powered-By:",$html);
$stripZ2=explode("HTTP/1.0",$stripZ[0]);
if(trim($stripZ2[1])=="302 Found") {
$remove=1;
}
break; //zs
case 6:
$striph=explode("HTTP/1.1",$html);
$striph2=explode("Date:",$striph[1]);
if(trim($striph2[0])=="302 Found") {
$remove=1;
}
break; //stagevu
?>
merci de m'avoir rependu aussi vite
j'ai trouver ca
<?
error_reporting(E_ALL);
// Gets everything headers and HTML
function geteverything($url) {
// Gets url ready to use
$info = @parse_url( $url );
// Opens socket
$fp= @fsockopen( $info["host"], 80, $errno, $errstr, 10 );
// Makes sure the socket is open or returns false
if ( !$fp ) {
return false ;
}
else {
// Checks the path is not empty
if( empty( $info["path"] ) ) {
// If it is empty it fills it
$info["path"] = "/";
}
$query = "";
// Checks if there is a query string in the url
if( isset( $info["query"] ) ) {
// If there is a query string it adds a ? to the front of it
$query = "?".$info["query"]."";
}
// Sets the headers to send
$out = "GET ".$info["path"]."".$query." HTTP/1.0\r\n";
$out .= "Host: ".$info["host"]."\r\n";
$out .= "Connection: close \r\n";
$out .= "User-Agent: link_checker/1.1\r\n\r\n";
// writes the headers out
fwrite( $fp, $out );
$html = '';
// Reads what gets sent back
while ( !feof( $fp ) ) {
$html .= fread( $fp, 8192 );
}
// Closes socket
fclose( $fp );
}
return $html;
}
/////// End of Gets everything headers and HTML ////////////////
?>
et en appel a cet fonction mais je sais pas ou n'est ou mettre ce code :
<?php require("url_check.php")
$html = geteverything($url);
if(!$html){
//header("Location: introuvable.php?stat=error");
}
else {
// Get status code
$remove=0;
switch ($id_players){
case 4:
$stripZ=explode("X-Powered-By:",$html);
$stripZ2=explode("HTTP/1.0",$stripZ[0]);
if(trim($stripZ2[1])=="302 Found") {
$remove=1;
}
break; //zs
case 6:
$striph=explode("HTTP/1.1",$html);
$striph2=explode("Date:",$striph[1]);
if(trim($striph2[0])=="302 Found") {
$remove=1;
}
break; //stagevu
?>