Solved

Auto Login

Posted on 2008-06-16
4
972 Views
Last Modified: 2013-11-18
PHP cide is shown below:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.earnbyads.co.in/login.aspx');
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "Login1$txtUserName=user&Login1$txtPassword=userj&Login1$ddlTypeOfUser=WebUser&__VIEWSTATE=/wEPDwUKMTA0MTQ4OTU0Mg9kFgICAQ9kFgJmD2QWBAIDDw8WAh4EVGV4dGVkZAINDw9kFgIeB29uY2xpY2sFEnJldHVybiBWYWxpZGF0ZSgpO2RkVud2yrSAmKdGEaCh/XGSWjDscZ0=");
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
//# Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL
//# not to print out the results of its query.
//# Instead, it will return the results as a string return value
//# from curl_exec() instead of the usual true/false.
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$store = curl_exec ($ch);
echo $store;
curl_close ($ch);
?>

This was written to autologin at the site. But it is not working . What could be the reason?
0
Comment
Question by:soorajb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Expert Comment

by:mattskelton
ID: 21796023
Hi soorajb,

First off, looks like the site is written using .net (aspx) or are you using a URL Rewrite tool? If so, could you please provide some more info. What exactly do you mean "autologin at the site"? Do you want the username/password box to be filled in when you browse to that page. If so, look into cookies that store a user name (& possibly an encrypted password although that is not recommended).

Matt
0
 
LVL 19

Expert Comment

by:BrianGEFF719
ID: 21796778
Try removing viewstate.

0
 
LVL 1

Author Comment

by:soorajb
ID: 22139191
Sorry for my late reply.
Well i need to login to that site. i mean my php script should login to that site and check for its default page. the default page has some info which needs to be extracted!

can u say anything for that?
0
 
LVL 1

Accepted Solution

by:
soorajb earned 0 total points
ID: 22139203
removing viewstae does not work!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question