connecting to gateway by php

Started on the old forum in December 2010 · view the original in the archive · old links redirect here

21 replies · 4,124 views · started 15 years ago · 1 min read

TL;DR · summary of 21 replies
  • -ksg91 suggested using fsockopen or curl to make a socket connection.
  • -The username and password alone are not enough to log in, commands need to be sent as well.
  • -A user provided an example of authentication commands for mig33.
  • -Atef asked for more specific examples but did not receive one.

Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.

11 participants
atef201080 Developer · 58 posts #1

hy all please i want to know how i can make a php script to connect to gateway.mig33.com and port 9119 by a username and password Thanks

Anshul Senior · 296 posts #2

atef201080 wrote: hy all please i want to know how i can make a php script to connect to gateway.mig33.com and port 9119 by a username and password Thanks

why u want to do that ??

frostymarvelous Senior · 266 posts #3

Have you tried using curl?

Perfection comes at a cost

I accept liberty!

atef201080 Developer · 58 posts #4

i dont kn0w what is curl i will make a users kicker like some1 enter a 9 mig33 ids and password and that 9 ids join a chat room at mig33 and kick a user thats all

atef201080 Developer · 58 posts #6

and where i enter username and password to login!

frostymarvelous Senior · 266 posts #7

If mig33 uses get, you can just pass the username and password in the server.

Perfection comes at a cost

I accept liberty!

warfrek Junior · 44 posts #9

study fsockopen ..u can make use of that .

frostymarvelous Senior · 266 posts #10

warfrek wrote: study fsockopen ..u can make use of that .

well, i believe studying curl will be a better use of your time. fsock is more supported, but curl beats it by far.

warfrek wrote: study fsockopen ..u can make use of that .

well, i believe studying curl will be a better use of your time. fsock is more supported, but curl beats it by far.

Perfection comes at a cost

I accept liberty!

atef201080 Developer · 58 posts #11

i usd that code

login.php

<?php
set_time_limit(0);
$host   = 'gateway.mig33.com';
$port   = '9119';
$user   = $_POST['user'];
$pass   = $_POST['pass'];
$socket = fsockopen($host, $port) or die('Could not connect to: '.$host);
$userdota = "palma";
if($socket)
{
    sendcmd("\r",$socket);
    $status = "open";
       
    while($status=="open")
      {    
             $line = @fgets($socket, 1024) ;
              /////////////login////////////////   
            if (strstr($line, "there is no guest account"))
              {
                 sendcmd($user."\r\n",$socket);
                 sendcmd($pass."\r\n",$socket);
              }   
            //////////////send command ////////////////////
            if (strstr($line,"Your unique name: ".$user))
              {  sendcmd("/finger ".$userdota."\r\n",$socket);
              }
           
            if (strstr($line,"ERROR: Invalid user."))
              { 
                
                 fclose($socket);
                 $status="close";
                 $error ="Invalid User";
              }
           
            ////////////login failed //////////////////////////            
            if (strstr($line, "Login failed"))
              {
                 $error = "Login Failed";
                 fclose($socket);
                 $status="close";
              }
           
            flush();
     
      }
         
}
function sendcmd($cmd,$socket)
{
  fputs($socket, $cmd, strlen($cmd));
}
?>

and index.php

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login</title>
</head>
<body>

<form method="post" action="login.php">
<br>
Username: <br>
<input type="text" name="user" size="35" />
<br>
Password:<br>
<input type="password" name="pass" size="35" />
<br>
<input type="submit" value="Login" />
<br>
</form>

</html>

but the username not logged in

ksg91 Developer · 162 posts #12

Sending just Username and password wont log you in. You need to know commands for that. They might be

USER username
PASS password

you have to send this commands to authenticate. I never worked with mig33 so have no idea about their commands.

Follow me @ksg91 | My Blog: http://ksg91.com | Nokia Blog: http://NokiaTips.in

ksg91 Developer · 162 posts #16

Example:

<?php
$host = "http://gateway.mig33.com";
$port = 9119;
$user = "username";
$pw = "password";
$socket = fsockopen($host,$pw);
fputs($socket,"USER ".$user); // sends username assuming USER is command
fputs($socket,"PASS ".$pass);//sends password 
?>

This will authenticate you, rest is up to you.

CreativityKills wrote: Dnt bother urselves, if the migg developers wanted to make their data available to the public, they'd make an API.

agree.

Follow me @ksg91 | My Blog: http://ksg91.com | Nokia Blog: http://NokiaTips.in

arzy Newbie · 1 posts #17

bot

anyone can tell me how to make online bot???pls

borne Newbie · 8 posts #19

this little code might help you, but its not working anymore,just fix it urself. example u save it as bot.php then create a cron job to it through your cpanel (your host must have cron job feature,..of course)

<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, “<http://wap.mig33.com/member2/t.php?username=USERNAME&password=PASSWORD&rememberName=on&action=Sign+in&cmd=login”%29;> curl_exec($ch); curl_close($ch); $ch = curl_init(); ?>
Yuans Kharista Newbie · 1 posts #20

atef ini saya kasih source code login mig33 yang dulu pernah saya gunakan ini sample source nya

<?Php if(stristr($_SERVER['PHP_SELF'], "mig33API.php")) { die("<h4>You don't have right permission to access this file directly.</h4>"); } /** @OpenKampus mig33API system @PHP Class to perform mig33 action @author goMbiLe.Inc @http://mishacker.net/mig33/ **/ include "protectedUser.lst.php"; //DB for protected user include "premiumUser.lst.php"; //DB for premium user include "fungsi.php"; class gombile { /* Access private */ var $serverHost = "gateway.mig33.com"; //Compatible mig33 server wap.mig33.com port:80, m.mig33.com port:80 var $serverPort = 25; var $filePath = "/member2/t.php"; var $username = null; var $userdef = "cah_gombile"; //handling temporarly cookies var $_cookie = null; //handling fsockopen connection var $fp_handle = null; var $_respon = null; var $_debug = true; var $_debugMsg = array(); var $inRoom = false; var $isPV = false; var $startKick = false; var $kickMe = false; //r vote 2 kick current user is started? /* Access public */ //do login to server function Login($usr, $pwd, $rem=false, $inv=false, $ret=false){ $cookie = is_null($this->_cookie)?"":$this->_cookie; $usr = urlencode($usr); $pwd = urlencode($pwd); //$content: parameter yg akan dikirim ke server lewat method POST $params = "cmd=login&username=$usr&password=$pwd"; $params .= ($rem === true?"&rememberName=on":""); $params .= ($inv === true?"&invisible=on":""); //creating connection to server $this->_createConnection("POST", $this->filePath, $cookie, null, $params, false, false); //get cookie"s $Cookies = array(); if($this->fp_handle) { while(!feof($this->fp_handle)){ //get server respon $respon = @fgets($this->fp_handle, 4096); $this->_respon .= $respon; //get cookie from server respon $isCookie = stristr($respon, "set-cookie"); if($isCookie) { $Cookies[] .= trim(str_ireplace("set-cookie: ", "", $isCookie)); } } }else{ $this->_debugMsg[] .= "Sorry, we couldn't connect to the mig33 server. This is out of our control."; }

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close