Click here to Skip to main content
15,908,768 members
Please Sign up or sign in to vote.
3.15/5 (4 votes)
See more:
hi dears

i try to login in nimbuzz web site with web request, but cant!

C#
Dim uri As String = "http://www.nimbuzzout.com/en/nimbuzzout/login"

        Dim request As WebRequest = WebRequest.Create(uri)
        request.Method = "POST"

        Dim postData As String = "sUserName=test&sPassword=12345&btnSubmit=Click"
        Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
        request.ContentType = "application/x-www-form-urlencoded"
        request.ContentLength = byteArray.Length

        Dim dataStream As Stream = request.GetRequestStream()
        dataStream.Write(byteArray, 0, byteArray.Length)
        dataStream.Close()
        Dim response As WebResponse = request.GetResponse()
        Console.WriteLine(CType(response, HttpWebResponse).StatusDescription)
        dataStream = response.GetResponseStream()
        Dim reader As New StreamReader(dataStream)
        Dim responseFromServer As String = reader.ReadToEnd()
        TextBox1.Text = responseFromServer

        reader.Close()
        dataStream.Close()
        response.Close()



and page source

C#
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Nimbuzz.com :: login</title>
<meta name="description" content="" />
<meta name="generator" content="concrete5 - 5.6.1.1" />
<script type="text/javascript">
var CCM_DISPATCHER_FILENAME = '/index.php';
var CCM_CID = 279;
var CCM_EDIT_MODE = false;
var CCM_ARRANGE_MODE = false;
var CCM_IMAGE_PATH = "/concrete/images";
var CCM_TOOLS_PATH = "/index.php/tools/required";
var CCM_BASE_URL = "http://www.nimbuzzout.com";
var CCM_REL = "";

</script>


<link rel="stylesheet" type="text/css" href="/concrete/css/ccm.base.css?v=b22f6f15bc93474d9571b4a8757a7608" />
<script type="text/javascript" src="/concrete/js/jquery.js?v=b22f6f15bc93474d9571b4a8757a7608"></script>
<script type="text/javascript" src="/concrete/js/ccm.base.js?v=b22f6f15bc93474d9571b4a8757a7608"></script>
<link rel="stylesheet" media="screen" type="text/css" href="/css/nimbuzz_out_main.css" />
<script type="text/javascript" src="/js/general.js"></script>
<script type="text/javascript">
	var currentLang = 'en';
	$(document).ready(function(){
		initLayout();	
	});
</script>
</head>
<body>
<div id="header" class="mnHdr">
	<div class="innrHdr">
    	<h1 class="logo"><a href="http://www.nimbuzzout.com/en/nimbuzzout/index"></a></h1>
        <ul class="nav" id="auth_true" style="display:none;">
            <li class="sep"</li>
            <li><a href="http://www.nimbuzzout.com/en/nimbuzzout/myaccount">My Account</a></li>
            <li><a href="http://www.nimbuzzout.com/signout/?s=signout">Logout</a></li>
			<li class="sep"</li>
        </ul>
        <ul class="nav" id="auth_false">
            <li><a href="http://www.nimbuzzout.com/en/nimbuzzout/howitworks">How it Works?</a></li>
            <li><a href="http://www.nimbuzz.com/en/get/voip-and-chat-on-pc" target="_blank">Download Nimbuzz</a></li>
            <li class="sep"</li>            
            <li><a href="http://www.nimbuzzout.com/en/nimbuzzout/login">Login</a></li>
            <li id="spectranet_register" style="display:none;"><a href="http://www.nimbuzzout.com/en/spectranet-create-account/">Create Account</a></li>
            <li id="nout_register" style="display: block;"><a href="http://www.nimbuzzout.com/en/nimbuzzout/register">Create Account</a></li>
            <li class="sep"</li>
        </ul>

        <div class="clear"></div>
    </div>
    <div class="orngWv">
    	<div class="wave"></div>
    </div>
</div>
<script type="text/javascript" lang="javascript">
function getHeaderLoad(){
	$.ajax({url: "/lazy_load_direct.php", 
		context: document.body, 
		dataType: 'json',
		timeout: 5000,
		data: {'function':'getNoutHeader'},
		beforeSend: function(){
			
		},
		success: function(data){
			if(data!="IR"){
				var loadA = data.loadA; 
				var loadSpectranet = data.spectranetLink; 
				if(loadA===true){
					$("#auth_true").show();
					$("#auth_false").hide();
				}
				else{
					$("#auth_false").show();
					$("#auth_true").hide();
				}
				//if(loadSpectranet===true){
				//	$("#spectranet_register").show();
				//	$("#nout_register").hide();
				//}
				//else{
					$("#nout_register").show();
					$("#spectranet_register").hide();
				//}
			}
		},
		error:function(){
		}
	});
}
getHeaderLoad();
</script>
<div id="mainwrapper" class="mnWrpr">
	<div class="cntWrpr">
    	<div class="cntArea">
		<div class="ttl bgttl">
            	<h3>
<div id="HTMLBlock981" class="HTMLBlock">
Signin</div></h3>
            </div>
            <div class="imgPlcHldr">
		<img border="0" class="ccm-image-block" alt="" src="/files/9013/6661/4282/nout-sgninim.png" width="298" height="248" />	    </div>
            <div class="lftBlck">
		
<div id="HTMLBlock983" class="HTMLBlock">
Sign in with your Nimbuzz Account</div>	    </div>
        </div>
        <div class="clear"></div>
    </div>
</div>

<div class="innrPg">
     <div class="innrPgBlck">
	<div class="lavabar"></div>
<div id="general_errors" style="display:none;">
	<label for="sError" generated="true" class="tmpErr" style="display: block;">
	</label>
</div>
<div class="frmLstLogin">
	<form id="loginForm" name="loginForm" method="post" action="https://www.nimbuzzout.com/post" enctype="application/x-www-form-urlencoded">
		<input type="hidden" name="function" value="NimbuzzOutLogin" />
		<input type="hidden" name="uType" value="1" />
		<p>
			<label style="float:left;width:140px;">Username</label>
			<span style="float:left;width:300px;">
			<input id="sUserName" name="sUserName" type="text" value="" />
			</span>
			<span style="clear:both"></span>
		</p>
		<p class="err"><label></label><span><label for="sUserName" generated="true" class="err" style="display:none"></label></span></p>
		<p>
			<label style="float:left;width:140px;">Password</label>
			<span style="float:left;width:300px;">
				<input id="sPassword" name="sPassword" type="password" value="" />
			</span>
			<span style="clear:both"></span>
		</p>
		<p class="err"><label></label><span><label for="sPassword" generated="true" class="err" style="display:none;"></label></span></p>
		<p><label></label><span><input type="checkbox" name="sRememberPass" id="sRememberPass" checked="checked" /> <font>Remember password</font></span></p>
		<p>
			<label></label>
			<span>
				<input type="submit" id="btnSubmit" class="buyBtn pdR40 marR12" value="Continue" />
				<a href="http://www.nimbuzz.com/en/forgot-password">Forgot password?</a>
			</span>
		</p>
	</form>
</div>
<div class="rgtBlck frmRgt">
	<form action="http://www.nimbuzzout.com/en/nimbuzzout/register">
		<h3>Haven't joined the party yet?</h3>
		<input type="submit" class="gryBtn" value="Create account" />
		<div class="spacer20"></div>
		<span>You've made a wise decision!</span>
		<span>Create your Nimbuzz account here and soon you'll connect with all of your friends from any platform, any operator and any social network, all in one place. </span>
		<span>It’s the new way to do mobile.</span>
	</form>
</div>
<div class="clear"></div>
<script type="text/javascript">
	function getRef(){
		if(getCookie('ref')=="" || getCookie('ref')!='omg'){
			setCookie('ref','omg','1397214060000');
		}
	}
	function getParameterByName(name) {
		name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
		var regex = new RegExp("[\\?&]" + name + "=([^]*)"),
        results = regex.exec(location.search);
		return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
	}
	function getCookie(cname){
		var name = cname + "=";
		var ca = document.cookie.split(';');
		for(var i=0; i<ca.length; i++){
			var c = ca[i].trim();
			if (c.indexOf(name)==0) return c.substring(name.length,c.length);
		}
		return "";
	}
	function setCookie(cname,cvalue,exdays){
		var d = new Date();
		d.setTime(exdays);
		var expires = "expires="+d.toGMTString();
		document.cookie = cname + "=" + cvalue + "; " + expires+";path=/";
	} 
	var name ="ref";
	var queryData = getParameterByName(name);
	if(queryData=="omg"){
		getRef();
		$.ajax({url: "/lazy_load_direct.php", 
			context: document.body, 
			dataType: 'json',
			timeout: 5000,
			data: {'function':'check'},
			beforeSend: function(){
			},
			success: function(data){
				if(data!="IR"){
					//var valid_details = data.validations;						
					//console.log(valid_details);
				}
			},
			error:function(){
			}
		});
	}

	var username_required = "Username is required";
	var username_length = "Username is too short";
	var password_required = "Password is required";
	var password_length = "Password is too short";
	var user_name = "User Name";
	var password = "Password";
	var generic_error = "Something was wrong, Please try again later.";
	//$(document).ready(function() {
	$('#btnSubmit').click(function() {  
		var check = true;
		$('[for=sUserName]').html();
		$('[for=sUserName]').hide();
		$('[for=sPassword]').html();
		$('[for=sPassword]').hide();	
		var Suval = $.trim($("#sUserName").val());
		var Spval = $.trim($("#sPassword").val());
		if(Suval == "" || Suval == user_name ){
			$('[for=sUserName]').html(username_required);
			$('[for=sUserName]').show();
			check = false;
		}
		else if(Suval.length <3){
			$('[for=sUserName]').html(username_length);
			$('[for=sUserName]').show();
			check = false;
		}
		if(Spval == "" || Spval == password ){
			$('[for=sPassword]').html(password_required);
			$('[for=sPassword]').show();
			check = false;
		}
		else if(Spval.length <5){
			$('[for=sPassword]').html(password_length);
			$('[for=sPassword]').show();
			check = false;
		}
		if(check == false){
			return false;
		}
		else {
			return true;
		}
		/*$("#loginForm").validate({
			wrapper:'p',
			//debug:true,
			errorClass:'err',
			//ignoreTitle: true,
			rules: {'sUserName':{required:true, minlength: 3, no_equal_str:user_name},
					'sPassword':{required:true, minlength: 5, no_equal_str:password}
				},
		   messages: {
			'sUserName':{
				 required: username_required,
				 minlength: username_length,
				 no_equal_str: username_required
			},
			'sPassword': {
			   required: password_required,
			   minlength: password_length,
			   no_equal_str: password_required
			 } 
		   }	
		});*/
		
	});
	function getLoginError(){
		$.ajax({url: "/lazy_load_direct.php", 
			context: document.body, 
			dataType: 'json',
			timeout: 5000,
			data: {'function':'signin'},
			beforeSend: function(){
				//$('select#sModels').removeClass('error');
				//$('select#sModels').empty();
				//$('select#sModels').attr('disabled', 'disabled');
			},
			success: function(data){
				if(data!="IR"){
					var valid_details = data.validations;						
					if(valid_details.general.is==true){
							$('[for=sError]').html(valid_details.general.txt);
							$('#general_errors').show();
							$('[for=sError]').show();
					}
				}
			},
			error:function(){
			}
		});
	}
	getLoginError();
</script>
     </div>
</div>

<div class="footer">
	<div class="ftTop">
    	<div class="ftrWv"></div>
    </div>
    <div class="ftBtm">
    	<div class="ftrClip">
            <div class="ftrLnk">
            	<div id="non_login_links" style="display:none">
		<a href="http://www.nimbuzzout.com/en/nimbuzzout/howitworks">How it Works?</a>
                <a href="http://www.nimbuzz.com/en/legal/privacy-statement" target="_blank">Privacy & Terms</a>
                <a href="http://www.nimbuzz.com/en/contact-us/?n=4" target="_blank">Contact Us</a>
                <a href="http://www.nimbuzzout.com/en/nimbuzzout/faq">FAQs</a>
                <a href="http://www.nimbuzzout.com/en/nimbuzzout/reseller">Reseller Program</a>
                <a href="http://www.nimbuzz.com" target="_blank">Nimbuzz.com</a>
                </div>
            </div>
            <div class="ftrRgt">
                <div class="share">
                <span>Follow us</span>
                <div class="communities">
                <a href="https://twitter.com/nimbuzz" target="_blank"><img alt="twitter" src="/images/nout_images/twitter_icon.png" width="33" height="33"></a>
                <a href="http://www.facebook.com/Nimbuzz" target="_blank"><img border="0" alt="facebook" src="/images/nout_images/fb_icon.png" width="33" height="33"></a>
                </div>
                </div>
                Secure Payment
            </div>	
            <div class="clear"></div>
        </div>
    </div>
</div>
<script type="text/javascript" lang="javascript">
function getFooterCheck(){
	$.ajax({url: "/lazy_load_direct.php", 
		context: document.body, 
		dataType: 'json',
		timeout: 5000,
		data: {'function':'getNoutFooter'},
		beforeSend: function(){
		},
		success: function(data){
			if(data!="IR"){
				var authF = data.loadF;
				if(authF==true){
					$("#non_login_links").hide();
				}else{
					$("#non_login_links").show();
				}
			}
		},
		error:function(){
		}
	});
}
getFooterCheck();
</script>
<script type="text/javascript">
		var _gaq = _gaq || [];
		_gaq.push([ "_setAccount", "UA-280655-1" ]);
		_gaq.push([ "_setDomainName", "nimbuzzout.com" ]);
		_gaq.push([ "_setAllowLinker", true ]);
		_gaq.push([ "_trackPageview" ]);
		(function() {
			var b = document.createElement("script");
			b.type = "text/javascript";
			b.async = true;
			b.src = ("https:" == document.location.protocol ? "https://ssl"
					: "http://www")
					+ ".google-analytics.com/ga.js";
			var a = document.getElementsByTagName("script")[0];
			a.parentNode.insertBefore(b, a)
		})();
</script>
<script type="text/javascript" src="/js/jquery.validate.js"></script>
<script type="text/javascript" src="/js/jquery.cookie.js"></script>
</body>
</html>
Posted
Updated 15-Mar-14 3:55am
v2
Comments
ZurdoDev 12-Mar-14 12:11pm    
This is too much code. You need to narrow it down to only the relative code. And why doesn't it work? What do you get back?
Do you see encounter any Exception?

You should use a free tool like fiddler to view the communication from/to the browser. This will help you determine what to mimic when you build your web request.

I don't know if it's the cause of your issue but I can see you are not passing everything in your post data that the page sends when used normally via a browser.

Try updating your post data to be...
VB
Dim postData As String = "function=NimbuzzOutLogin&uType=1&sUserName=test&sPassword=12345"
 
Share this answer
 
idenizeni: i cant login to http://www.nimbuzzout.com/en/nimbuzzout/login[^]

with web request!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900