Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * WimbledonComProvider Class
- *
- * Provider for Newsletterregistration at http://www.wimbledon.com
- *
- */
- class WimbledonComProvider extends FormSubmitter {
- /**
- * @var String url to submit the form to
- */
- protected $url = 'http://www.wimbledon.com/en_GB/contact/register.html';
- /**
- * @var String http method to use for submit
- */
- protected $method = 'POST';
- /**
- * Populate the form_data array
- *
- * @param String $email email to be used
- */
- protected function fill($email) {
- /* Default form fields */
- $this->addField('Email Address', $email);
- $this->addField('Full Name', 'Name');
- $this->addField('Country', 'United Kingdom');
- $this->addField('Email Type', 'HTML');
- /* CSRR */
- $response = $this->get($this->url);
- $form = $response['form'];
- $this->addField('lid', $form['lid']);
- $this->addField('MID', $form['MID']);
- /* Submit */
- $this->addField('submit', 'submit');
- }
- /**
- * Check response for success
- *
- * @param Array $headers associative arrays of http response headers
- * @param String $data http response data
- */
- protected function check($headers, $data, $url) {
- if ( preg_match('/.*register_error\.html.*/', $url) )
- return FormSubmitter::fail;
- if ( preg_match('/.*register_complete\.html.*/', $url) )
- return FormSubmitter::success;
- return FormSubmitter::unknown;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement