note 48465 deleted from ref.curl by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 19:41:57 +0000 |
| Subject: | note 48465 deleted from ref.curl by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155254@lists.php.net to get a copy of this message | ||
Note Submitter: josh,endquote,com
----
If you're trying to post forms to an ASP.NET server, you will need to include the value of the
__VIEWSTATE hidden field in your post. You can get it like this:
<?php
$html = curl_exec($ch);
$matches = array();
preg_match('/<input type="hidden" name="__VIEWSTATE"
value="([^"]*?)" \/>/', $html, $matches);
$viewstate = $matches[1];
$viewstate = urlencode($viewstate);
?>
That last urlencode() is the bit that drove me crazy for a while.