Class HTML_Functions

Description

HTML Functions - common functions for extracting data from HTML

Located in Program_Root/HTML_Functions.php (line 9)


	
			
Variable Summary
mixed $find
object HTML_Parser $parser
mixed $result
Method Summary
void HTML_Functions ()
void create_parser ()
string get_form_action_by_index (mixed &$html, [mixed $index = 1])
string get_input_name_by_index (mixed &$html, mixed $index)
string get_input_name_value (mixed &$html, mixed $index, [mixed $form_index = null])
string get_input_type_by_index (mixed &$html, mixed $index)
string get_input_value_by_index (mixed &$html, mixed $index)
string get_input_value_by_name (mixed &$html, mixed $input_name)
string get_link_url (mixed $html, mixed $link_name)
string get_string_after (mixed $html, mixed $text_before)
void reset_vars ()
void _cb_get_form_action_by_index (mixed &$parser, mixed $element, mixed $atts)
void _cb_get_input_by_index (mixed &$parser, mixed $element, mixed $atts)
void _cb_get_input_value_by_name (mixed &$parser, mixed $element, mixed $atts)
Variables
mixed $find (line 15)

Find (used by HTML_Parser callback functions)

object HTML_Parser $parser (line 27)

HTML Parser

mixed $result (line 21)

Result (used by HTML_Parser callback functions)

Methods
Constructor HTML_Functions (line 29)
void HTML_Functions ()
create_parser (line 33)
void create_parser ()
get_form_action_by_index (line 176)

Get form action by index

Get action of form tag $index, where index 1 is the first form tag. Example:


1 $html = '<form name="aForm" action="http://www.domain.com/submit.php">
2 <input type="hidden" name="firstname" value="John" />
3 <input type="hidden" name="surname" value="Smith" />
4 </form>';
5 echo $html_func->get_form_action_by_index($html, 1);
6

string get_form_action_by_index (mixed &$html, [mixed $index = 1])
get_input_name_by_index (line 139)

Get input name by index

Get name of input tag $index, where index 1 is the first input tag. Example:


1 $html = '<form>
2 <input type="hidden" name="firstname" value="John" />
3 <input type="hidden" name="surname" value="Smith" />
4 </form>';
5 echo $html_func->get_input_name_by_index($html, 2);
6

string get_input_name_by_index (mixed &$html, mixed $index)
get_input_name_value (line 299)

Get input name and value by index

Get name and value of input tag $index, where index 1 is the first input tag. Example:


1 $html = '<form>
2 <input type="hidden" name="firstname" value="John" />
3 <input type="hidden" name="surname" value="Smith" />
4 </form>';
5 echo $html_func->get_input_name_value($html, 2);
6
Or, if there's more than 1 form...

1 $html = '<form name="form1">
2 <input type="hidden" name="firstname" value="John" />
3 <input type="hidden" name="surname" value="Smith" />
4 </form>
5 <form name="form2">
6 <input type="hidden" name="age" value="20" />
7 <input type="hidden" name="sex" value="m" />
8 </form>';
9 echo $html_func->get_input_name_value($html, 1, 2);
10

string get_input_name_value (mixed &$html, mixed $index, [mixed $form_index = null])
get_input_type_by_index (line 249)

Get input value by index

Get value of input tag $index, where index 1 is the first input tag. Example:


1 $html = '<form>
2 <input type="hidden" name="firstname" value="John" />
3 <input type="hidden" name="surname" value="Smith" />
4 </form>';
5 echo $html_func->get_input_name_by_index($html, 2);
6

string get_input_type_by_index (mixed &$html, mixed $index)
get_input_value_by_index (line 212)

Get input value by index

Get value of input tag $index, where index 1 is the first input tag. Example:


1 $html = '<form>
2 <input type="hidden" name="firstname" value="John" />
3 <input type="hidden" name="surname" value="Smith" />
4 </form>';
5 echo $html_func->get_input_name_by_index($html, 2);
6

string get_input_value_by_index (mixed &$html, mixed $index)
get_input_value_by_name (line 107)

Get input value

Get value of input tag whose name attribute value is $input_name Example:


1 $html = '<form>
2 <input type="hidden" name="surname" value="Smith" />
3 </form>';
4 echo $html_func->get_input_value_by_name($html, 'surname');
5

string get_input_value_by_name (mixed &$html, mixed $input_name)
get_link_url (line 66)

Get link url

Returns URL string for link named $link_name Example:


1 $html = '<a href="http://www.domain.com/bla/bla.html">Great Site</a>';
2 echo $html_functions->get_link_url($html, 'Great Site');
3

  • return:

    returns false if value not found

string get_link_url (mixed $html, mixed $link_name)
get_string_after (line 82)

Get string after

Returns string found just after $text_before (after removing space and quotes)

  • return:

    returns false if value not found

string get_string_after (mixed $html, mixed $text_before)
reset_vars (line 47)

Reset vars

void reset_vars ()
_cb_get_form_action_by_index (line 383)

Start element handler to find form action values

void _cb_get_form_action_by_index (mixed &$parser, mixed $element, mixed $atts)
_cb_get_input_by_index (line 344)

Start element handler to find input values by index

void _cb_get_input_by_index (mixed &$parser, mixed $element, mixed $atts)
_cb_get_input_value_by_name (line 330)

Start element handler to find input value

void _cb_get_input_value_by_name (mixed &$parser, mixed $element, mixed $atts)

Documention generated on Sat, 19 Jul 2003 03:43:19 +0100 by phpDocumentor 1.2.0