Results 1 to 3 of 3

Thread: ReadExternalSCARMessage

  1. #1
    Join Date
    Mar 2007
    Posts
    3,116
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default ReadExternalSCARMessage

    Well, I always wanted to have to scar send messages over the internet to each other. So I made this:
    PHP Code:
    <?php
    function str_between($str$betw$betw2//by Ron
    {
      
    $str " " $str;
      
    $pos strpos($str$betw);
      if (
    $pos 0)
      {
        
    $str2 substr($str$pos strlen($betw));
        
    $pos2 strpos($str2$betw2);
        if (
    $pos2 == 0)
          return 
    '';
        return 
    substr($str20$pos2);
      }
      else
        return 
    '';
    }

    if(isset(
    $_POST['Content'])){
      
    $Content $_POST['Content'];
      
    $Id $_POST['Id'];
      
    $fp fopen("report.txt""a");
      
    fwrite($fp'<'.$Id.'>'.$Content.'</'.$Id.'>');
      
    fclose($fp);
      echo 
    'Done';
    }else{
      
    $Id $_POST['Id'];  
      
    $file fopen("report.txt","r");
      echo 
    Str_between(fread($file,filesize("report.txt")), '<'.$Id.'>''</'.$Id.'>');
      
    fclose($file);
    }  
    ?>
    SCAR Code:
    program New;
    Function SendExternalSCARMessage(ID, Content:String):Boolean;
    var
      I:Integer;
    begin
      I:=InitializeHTTPClient(False, False);
      AddPostVariable(I, 'Id', ID);
      AddPostVariable(I, 'Content', Content);
      Result:=True;
      Writeln(PostHTTPPageEx(I, 'Url with the php file'));
    end;

    Function ReadExternalSCARMessage(ID:String):String;
    var
      I:Integer;
    begin
      I:=InitializeHTTPClient(False, False);
      ClearPostData(I);
      AddPostVariable(I, 'Id', ID);
      Result:=PostHTTPPageEx(I, 'Url with the php file');
    end;

    begin
      Writeln(ReadExternalSCARMessage('pie'));
    end.

    Credits to:
    mixster:for helping me with between, even though I just used rons after it all

  2. #2
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Wow, this is cool. Maybe we could use this for some thing like the old bots used to do for the randoms. We tell SCAR what the correct answer is, for example the mouderot random. Good job!
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  3. #3
    Join Date
    Mar 2007
    Posts
    3,116
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    So, sleepwalker? Its a start to it, but defiantly not the entire thing

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •