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=/';

	$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];

	 $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_COOKIEJAR	=> 'cookie.txt',
		CURLOPT_COOKIEFILE => 'cookie.txt',
		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

Who is Participating?

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

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.

have a go at it with 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.
WhistlingMtnAuthor Commented:
I've never heard of it. I'll try it out later today.
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?
OWASP Proactive Controls

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


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.
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.
WhistlingMtnAuthor Commented:
Hmm, I think it's not working because one of the set-cookie is "Secure"
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!
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

From novice to tech pro — start learning today.