Okay, I have a serialized array which gives me data like this
";i:938;s:35:" <li data-id="widgets" class="">
";i:939;s:38:" <span class="name">Widgets</span>
";i:940;s:34:" <span class="value">136</span>
";i:941;s:38:" <span class="clear"><!-- --></span>
";i:942;s:8:" </li>
";i:943;s:35:" <li data-id="pogs" class="">
";i:944;s:38:" <span class="name">Pogs</span>
";i:945;s:34:" <span class="value">169</span>
";i:946;s:38:" <span class="clear"><!-- --></span>
";i:947;s:8:" </li>
I use the following php to get widgets from the above segment from the page (I would use line number, except I cant guarantee it would always be the same number for the field)
$file = "http://example.com/datasheet";
$contents = file($file);
$s_contents = serialize($contents);
$base_widgets_pattern = '(data+.+widgets+.+\n+.+\n+.+\n+.+span)';
preg_match($base_widgets_pattern, $s_contents, $matches);
$base_widgets = serialize($matches);
$base_wid = str_replace("\n", "", $base_widgets);
giving you these lines
";i:938;s:35:" <li data-id="widgets" class="">
";i:939;s:38:" <span class="name">Widgets</span>
";i:940;s:34:" <span class="value">136</span>
";i:941;s:38:" <span class="clear"><!-- --></span>
Then I use this line of code to get the "value" amount
$widgets_pattern = '(<span class="value">+.+</span>)';
preg_match($widgets_pattern, $base_wid, $wid_matches);
$widgets = strip_tags($wid_matches[0]);
(returns 136 in this case)