trouble autosubmitting form with curl
Posted: Wed Jun 15, 2011 9:38 pm
Hi everyone,
I am having trouble filling out and submitting a form using CURL.
Here is the form:
[text]
</p><form action=""includes/process.php?action=update"" method="post">
<p style="text-align: center;">
<input style="width: 400px;" name="u" id="input" class="urlinput" size="40" type="text">
<input value=" Go " class="submitbutton" type="submit">
<br>
<input name="encodeURL" id="encodeURL" checked="checked" type="checkbox">
<label for="encodeURL" class="tooltip" title="Encode URL::Encodes the URL of the page you are viewing so that it does not contain the target site in plaintext.">Encode URL</label> <input name="encodePage" id="encodePage" type="checkbox">
<label for="encodePage" class="tooltip" title="Encode Page::Helps avoid filters by encoding the page before sending it and decoding it with javascript once received. This is not 100% reliable and may break functionality in some browsers.">Encode Page</label> <input name="allowCookies" id="allowCookies" checked="checked" type="checkbox">
<label for="allowCookies" class="tooltip" title="Allow Cookies::Cookies may be required on interactive websites (especially where you need to log in) but advertisers also use cookies to track your browsing habits.">Allow Cookies</label> <input name="stripJS" id="stripJS" type="checkbox">
<label for="stripJS" class="tooltip" title="Remove Scripts::Remove scripts to protect your anonymity and speed up page loads. However, not all sites will provide an HTML-only alternative. (Recommended)">Remove Scripts</label> <input name="stripObjects" id="stripObjects" type="checkbox">
<label for="stripObjects" class="tooltip" title="Remove Objects::You can increase page load times by removing unnecessary Flash, Java and other objects. If not removed, these may also compromise your anonymity.">Remove Objects</label>
<br><br>
[/text]
Here is my CURL code
The form does not seem to be submitted, by curl - The output from $data only returns the original webpage. Can anyone help?
Thanks in advance,
KC
I am having trouble filling out and submitting a form using CURL.
Here is the form:
[text]
</p><form action=""includes/process.php?action=update"" method="post">
<p style="text-align: center;">
<input style="width: 400px;" name="u" id="input" class="urlinput" size="40" type="text">
<input value=" Go " class="submitbutton" type="submit">
<br>
<input name="encodeURL" id="encodeURL" checked="checked" type="checkbox">
<label for="encodeURL" class="tooltip" title="Encode URL::Encodes the URL of the page you are viewing so that it does not contain the target site in plaintext.">Encode URL</label> <input name="encodePage" id="encodePage" type="checkbox">
<label for="encodePage" class="tooltip" title="Encode Page::Helps avoid filters by encoding the page before sending it and decoding it with javascript once received. This is not 100% reliable and may break functionality in some browsers.">Encode Page</label> <input name="allowCookies" id="allowCookies" checked="checked" type="checkbox">
<label for="allowCookies" class="tooltip" title="Allow Cookies::Cookies may be required on interactive websites (especially where you need to log in) but advertisers also use cookies to track your browsing habits.">Allow Cookies</label> <input name="stripJS" id="stripJS" type="checkbox">
<label for="stripJS" class="tooltip" title="Remove Scripts::Remove scripts to protect your anonymity and speed up page loads. However, not all sites will provide an HTML-only alternative. (Recommended)">Remove Scripts</label> <input name="stripObjects" id="stripObjects" type="checkbox">
<label for="stripObjects" class="tooltip" title="Remove Objects::You can increase page load times by removing unnecessary Flash, Java and other objects. If not removed, these may also compromise your anonymity.">Remove Objects</label>
<br><br>
[/text]
Here is my CURL code
Code: Select all
$ch = curl_init();
$timeout = 105;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'u=www.yahoo.com&encodeURL=on&allowCookies=on');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE_FILE); // Cookie management.
curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE_FILE);
curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1');
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$data = curl_exec($ch);
curl_close($ch);
return $data;
The form does not seem to be submitted, by curl - The output from $data only returns the original webpage. Can anyone help?
Thanks in advance,
KC