PHP Curl into ASPX website

Hey, I have sister websites, one of them is with a CM system in aspx ( do not have access to source code ). I'm trying to login and scrape from a list, but just.. nothing happens, no error.. any help would be wonderful. I've tested the script on non-aspx logins and it works fine, I've tried it using the EVENTSTATE and EVENTVALIDATION variables there or not.
$strCookie = 'PHPSESSID=' . $_COOKIE['PHPSESSID'] . '; path=/';
	session_write_close();

	$agent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";

	// Login

	$back = 'txtUsername=[username]&txtPassword=[password]&chkRememberMe=on&btnSubmit=Login';
	$back .= "&__EVENTVALIDATION=/wEWBQLTg7DMBQKl1bK4CQK1qbSRCwLC8qqaCgLCi9reA/HCC7Z/TFEFxbmdxzpyokLktjos";
	$back.= "&__EVENTSTATE/wEPDwULLTEyMTcwMTQ3MDFkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxYBBQ1jaGtSZW1lbWJlck1l+uyKxry09hPIkqVla98roCW+U9k=";
	$back_url = "[login url];
	
	$url=$back_url;
	$vars=$back;

	 $options = array(
		CURLOPT_REFERER => $back_url,
        CURLOPT_RETURNTRANSFER => true,     // return web page
        CURLOPT_HEADER         => false,    // don't return headers
        CURLOPT_FOLLOWLOCATION => true,     // follow redirects
        CURLOPT_ENCODING       => "",       // handle all encodings
        CURLOPT_AUTOREFERER    => true,     // set referer on redirect
        CURLOPT_CONNECTTIMEOUT => 120,      // timeout on connect
        CURLOPT_TIMEOUT        => 120,      // timeout on response
        CURLOPT_MAXREDIRS      => 10,       // stop after 10 redirects
		CURLOPT_POST		   =>1,
		CURLOPT_POSTFIELDS		=> $vars ,
		CURLOPT_COOKIEJAR	=> 'cookie.txt',
		CURLOPT_COOKIEFILE => 'cookie.txt',
		CURLOPT_SSL_VERIFYHOST => 0,
		CURLOPT_SSL_VERIFYPEER => 0,
		CURLOPT_USERAGENT => $agent,
		CURLOPT_COOKIE => $strCookie 
    );

    $ch      = curl_init( $url );

    curl_setopt_array( $ch, $options );

    $content = curl_exec( $ch );
    $err     = curl_errno( $ch );
    $errmsg  = curl_error( $ch );
    $header  = curl_getinfo( $ch );
    curl_close( $ch );

Open in new window

WhistlingMtnAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

p_nutsCommented:
have a go at it with snoopy..
http://sourceforge.net/projects/snoopy/
that does all the curl stuff for you.. much easier to use a class that works instead of having to re-invent the wheel.
P_nuts
0
WhistlingMtnAuthor Commented:
I've never heard of it. I'll try it out later today.
0
WhistlingMtnAuthor Commented:
Snoopy really doesn't have the greatest documentation, I can't seem to get it to work even with the logins I have working with libcurl. There doesn't seem to be an option to set the cookie file, do you know of an example somewhere of a snoopy login?
0
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

p_nutsCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
WhistlingMtnAuthor Commented:
Yea, I can't get it to work, I think I'll stick with the libcurl, at least I know I have that working on other logins.
0
WhistlingMtnAuthor Commented:
Ok, one step further, using the livehttpheaders plugin for Firefox I was able to direct grab the post vars from logging on, they must have had to be in a specific order. The cookie is created after login, but it doesn't seem to retain the session.. so onto that.
0
WhistlingMtnAuthor Commented:
Hmm, I think it's not working because one of the set-cookie is "Secure"
0
WhistlingMtnAuthor Commented:
Ok, I have a tentative success. I pulled the set-cookie line from the headers returned and appended it to the cookie file, and the first couple tests, successful!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.