Jump to content
php.lv forumi

Dabut lapas kodu?


slitz

Recommended Posts

ja vien abas lapas nav vienā domēnā, tad ar pliku javascriptu nevarēsi vajadzēs arī php scriptu vēl pa vidu:

 

[tavs xhr] ---------------> [ php scripts uz tava servera] -> [ www.blabla.lv/index.htm] ------\

[rezultats mainīgajā] <- [ php scripts uz tava servera] <- [ www.blabla.lv/index.htm] <---/

Link to comment
Share on other sites

<?php
$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);
if (!$fp) {
  echo "$errstr ($errno)<br />\n";
} else {
  $out = "GET / HTTP/1.1\r\n";
  $out .= "Host: www.example.com\r\n";
  $out .= "Connection: Close\r\n\r\n";

  $content = '';
  fwrite($fp, $out);
  while (!feof($fp)) {
   $content .= fgets($fp, 128);
  }
  fclose($fp);
}
?>
<html>
<head>
<script type="text/javascript">
<!--
var citas_lapas_kods='<?php echo $content; ?>';
//-->
</script>
</head>
</html>

Aproksimetlī.

Link to comment
Share on other sites

×
×
  • Create New...