note 48465 modified in ref.curl by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 19:41:53 +0000 |
| Subject: | note 48465 modified in ref.curl by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155253@lists.php.net to get a copy of this message | ||
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.
--was--
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:
$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.
http://php.net/manual/en/ref.curl.php