Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function postCaptchaForm($q, $continue, $token)
- {
- //create array of data to be posted
- $post_data['token'] = $token;
- $post_data['continue'] = $continue;
- $post_data['e'] = $q;
- //traverse array and prepare data for posting (key1=value1)
- foreach ($post_data as $key => $value) {
- $post_items[] = $key . '=' . $value;
- }
- //create the final string to be posted using implode()
- echo $post_string = implode('&', $post_items);
- //create cURL connection
- $curl_connection =
- curl_init("https://www.google.com/sorry/index");
- //set options
- curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
- curl_setopt($curl_connection, CURLOPT_USERAGENT,
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
- curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($curl_connection, CURLOPT_REFERER, $this->curl_captcha_url);
- //set data to be posted
- curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
- //perform our request
- echo $result = curl_exec($curl_connection);
- //show information regarding the request
- /* print_r(curl_getinfo($curl_connection));
- echo curl_errno($curl_connection) . '-' .
- curl_error($curl_connection);*/
- //close the connection
- curl_close($curl_connection);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement