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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.