/
Advanced Interactions

Advanced Interactions

 

Authentication  - submitForm() madl Function

On occasions when you are retrieving a page source into an Interaction you may require authorisation from a login form. This is often known as a "PassThru"...

To get around this issue you can use the "submitForm()" function in mADL. The mADL SubmitForm function can be used to:

  1. Fetch the form at the requested url.
  2. Submit the required parameters using a string containing the form name or a numeric value representing the form (0 can be used instead to select the first form found, 1 then next and so on.)
  3. Pass the array of values to the login form.
  4. Return the results of the fetch for additional formatting.

Here's an example:

$t->fetch("http://mywebsite.com/login.php");
$t->submitForm( 0, array( 'username'=>'myusername',
'passwd'=>'mypassword' )
);
// Then you can continue on with accessing the page by using the following:
$t->fetch("http://mywebsite.com/tickets.php?status=".$args[0]);
return $t->result;
 

For more information on the submitForm function - see the note here.