note 48465 added to ref.curl
| From: | josh at osu1 dot php dot net | Date: | Fri, 24 Dec 2004 16:58:57 +0000 |
| Subject: | note 48465 added to ref.curl | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-82261@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:
$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.
----
Manual Page -- http://www.php.net/manual/en/ref.curl.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+48465
Delete -- http://master.php.net/manage/user-notes.php?action=delete+48465&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48465&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48465&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48465&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48465&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48465&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+48465&report=yes
Search -- http://master.php.net/manage/user-notes.php