Bonjour,

J'ai un script qui vérifie la présence de backlinks sur d'autres sites web.
Certains sites ne passent pas, je voudrais passer par un proxy, pour récupérer le contenu du site distant, mais cela ne marche pas, povez-vous m'aider s'il vous plait ?



veriflien.js
<<<
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// holds an instance of XMLHttpRequest
var xmlHttp = createXmlHttpRequestObject();
var serverAddress = "smartproxyping.php";
 
// creates an XMLHttpRequest instance
function createXmlHttpRequestObject() 
{
  // will store the reference to the XMLHttpRequest object
  var xmlHttp;
  // this should work for all browsers except IE6 and older
  try
  {
    // try to create XMLHttpRequest object
    xmlHttp = new XMLHttpRequest();
  }
  catch(e)
  {
    // assume IE6 or older
    var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0",
                                    "MSXML2.XMLHTTP.5.0",
                                    "MSXML2.XMLHTTP.4.0",
                                    "MSXML2.XMLHTTP.3.0",
                                    "MSXML2.XMLHTTP",
                                    "Microsoft.XMLHTTP");
    // try every prog id until one works
 
    for (var i=0; i<XmlHttpVersions.length && !xmlHttp; i++) 
    {
      try 
      { 
        // try to create XMLHttpRequest object
        xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
      } 
      catch (e) {}
    }
  }
  // return the created object or display an error message
  if (!xmlHttp)
    alert("Error creating the XMLHttpRequest object.");
  else 
    return xmlHttp;
}
 
function process()
{
  // only continue if xmlHttp isn't void
  if (xmlHttp)
  {
    // try to connect to the server
    try
    {
        xmlHttp.open("GET", serverAddress, true);
        xmlHttp.onreadystatechange = affichagepage;
        xmlHttp.send(null);
      }
    catch(e)
    {
      alert("Can't connect to server:\n" + e.toString());
    }
  }
}
 
 
function affichagepage() 
{
  // when readyState is 4, we are ready to read the server response
  if (xmlHttp.readyState == 4) 
  {
    // continue only if HTTP status is "OK"
    if (xmlHttp.status == 200) 
    {
      try
      {
        // do something with the response from the server
		var response = xmlHttp.responseText;
		document.write(response);
      }
      catch(e)
      {
        // display error message
        alert("pas de retour 1 \n" + e.toString());
      } 
    } 
    else
    {
      // display status message
      alert("pas de retour 2 \n" + xmlHttp.statusText);
    }
  }
}
>>>


smartproxyping.php
<<<
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
// load the error handling module
require_once('error_handler.php');
// make sure the user's browser doesn't cache the result
header('Expires: Wed, 23 Dec 1980 00:30:00 GMT'); // time in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
// retrieve the action parameter
// check availability or get new random number?
 
$serverAddress = 'url.php';
// retrieve the random number from foreign server
$contenusite = file_get_contents($serverAddress);
// output the random number
echo $contenusite;
return $contenusite;
 
?>
>>>


error_handler.php
<<<
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
// set the user error handler method to be error_handler
set_error_handler('error_handler', E_ALL);
// error handler function
 
function error_handler($errNo, $errStr, $errFile, $errLine)
{
  // clear any output that has already been generated
  if(ob_get_length()) ob_clean();
  // output the error message 
  $error_message = 'ERRNO: ' . $errNo . chr(10) .
                   'TEXT: ' . $errStr . chr(10) .
                   'LOCATION: ' . $errFile . 
                   ', line ' . $errLine;
  echo $error_message;
  // prevent processing any more PHP scripts
  exit;
}
?>
>>>

url.php
<<<
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
<?php
 
$j=file_get_contents("http://www.foot-annuaire.com/");
return $j;
echo $j;
?>
>>>


Merci beaucoup