Jump to content

[SOLVED] connecting to another site


cha0sriderx

Recommended Posts

i wanted to connect to another site(nittolegends.com) get find out the newest version of the game that is out.  the page i want to check is http://www.nittolegends.com/download_sites.aspx and search for the text a href="http://download.nittolegends.com/NittoLegendsBeta0990.exe"

 

<?php
function checkversion($d_vlegends) {

  $host = "www.nittolegends.com";
  $page = "/download_sites.aspx";

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

    fwrite($fp, $out);
    while (!feof($fp)) {
      $line = fgets($fp, 128);
      $do = preg_match("/<a href=(.*)download.nittolegends.com(.*)\">/", $line, $matches);
      if ($do == "true") { 
        $str = str_replace("/NittoLegendsBeta", "", $matches[3]);
        $str = str_replace(".exe\"", "", $str);
        if ($d_vlegends < $str) { return $str; }
      }
    }
  fclose($fp);
  }
  return "false";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/76009-solved-connecting-to-another-site/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.