la page facebook ce charge dans div id= allh2
je veu que facebook souvre avec la session de lutilisateur qui est deja connecté sur chrome

j utilise 2 pages index.php qui fait apple a load.php


lindex.php
Code html : 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>Test load external files with javaScript  jQuery</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script src="jquery-1.7.1.js" type="text/javascript"></script>
    <script type="text/javascript">
      function loadContent(idLoad, url, clean, cleanjs, cleancss, cleanbody, useproxy) {
        //  alert('debut!');
        $("#"+idLoad).load(
          "loader.php?urlSee="+url+"&clean="+clean+"&cleanjs="+cleanjs+"&cleancss="+cleancss+"&cleanbody="+cleanbody+"&useProxy="+useproxy,
          function(responseText, textStatus, XMLHttpRequest) {
           // alert('Charg�!');
          });
      }
      ///////////
      $().ready(function() {
        $("#fb").click(function() {
            loadContent("allh2",'facebook.com',0,0,0,0,0)
          });
      });
    </script>
  </head>
  <body>
    <a href="#" id="fb">Facebook</a><br/>
    <div style="height: 500px; border: 1px solid #000; padding: 20px;" id="allh2">hgjhgjhgjg</div>
  </body>
</html>

et la page LOAD.php

Code php : 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
<?php
// Permet de nettoyer un peu le code!
$_REQUEST['clean'] = ((!isset($_REQUEST['clean'])) ? true : $_REQUEST['clean']);
$_REQUEST['cleanjs'] = ((!isset($_REQUEST['cleanjs'])) ? true : $_REQUEST['cleanjs']);
$_REQUEST['cleancss'] = ((!isset($_REQUEST['cleancss'])) ? true : $_REQUEST['cleancss']);
$_REQUEST['cleanbody'] = ((!isset($_REQUEST['cleanbody'])) ? true : $_REQUEST['cleanbody']);
$_REQUEST['cleaniframe'] = ((!isset($_REQUEST['cleaniframe'])) ? true : $_REQUEST['cleaniframe']);
$_REQUEST['useProxy'] = ((!isset($_REQUEST['useProxy'])) ? true : $_REQUEST['useProxy']);
$proxy = ((!isset($_REQUEST['proxy'])) ? "xx.xx.xx.xx:xx" : $_REQUEST['proxy']);
// Liste de proxy
//http://www.hidemyass.com/proxy-list/
function curl_get_file_contents($url,$proxyActivation=false) {
  global $proxy;
  $c = curl_init();
  curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($c, CURLOPT_USERAGENT, " Googlebot/2.1 (http://www.googlebot.com/bot.html)" );
  curl_setopt($c, CURLOPT_REFERER, $url);
 curl_setopt($c, CURLOPT_COOKIEFILE,"Paramètres - Cookies et données de site.htm");
  curl_setopt($c, CURLOPT_URL,$url);
  curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
  if($proxyActivation) {
    curl_setopt($c, CURLOPT_PROXY, $proxy);
  }
  $contents = curl_exec($c);
  //curl_close($c);
  if ($contents)
    return $contents;
  else
    return FALSE;
}
$body = curl_get_file_contents(urldecode($_REQUEST['urlSee']),$_REQUEST['useProxy']);
if ($_REQUEST['cleanbody']) {
  preg_match('`<body[^>]*>(.*)</body[^>]*>`isU', $body, $matches);
  $body = $matches[1];
}
if ($_REQUEST['cleanjs']) {
  $body = preg_replace('@<noscript[^>]*?>.*?</noscript>@si', '', $body);
  $body = preg_replace('@<script[^>]*?>.*?</script>@si', '', $body);
}
if ($_REQUEST['cleaniframe']) {
  $body = preg_replace('@<iframe[^>]*?>.*?</iframe>@si', '', $body);
}
if ($_REQUEST['cleancss']) {
  $body = preg_replace('@<style[^>]*?>.*?</style>@si', '', $body);
}
if ($_REQUEST['clean'])
  echo htmlentities($body);
else
  echo $body;
  ///////
   if(is_string($body)){
        $resultats = array();
        $nb_resultats = preg_match('#<div class="menu_login_container rfloat">(.+)</div>#isU', $body, $resultats);
        if($nb_resultats > 0){
            echo $resultats[1];;
        }
        else{
            echo 'Aucun résultat !';
        }
    }
    else{
        echo 'Erreur lors de la lecture du site !';
    }
 /* $resultats = array();
   $body = preg_match('#<div  id="yt-masthead">(.+)</div>#isU', $body, $resultats);
 echo $body;
echo $resultats[1];*/
?>