Extractor Patterns, Data Records and PHP Scripts?

I have an extractor pattern that checks for instances of author/author ID. If there are multiple instances, I understand that screen-scraper stores them in records.

Some related questions ...

1. Am I correct in my understanding that to access these records, I would need to write a script that uses the getDataRecord() or getAllDataRecords() APIs [and that the script must be added to the extractor pattern].

2. PHP is not an available scripting language in screen-scraper.

3. If a screen-scraping session is invoked from a PHP script, how do I make the records available to the PHP script?

Thanks,
Peter

Extractor Patterns, Data Records and PHP Scripts?

Hello again Todd,

Many thanks!

The sample code was exactly what I needed (but you already knew that).

I appreciate your guidance - and especially your patience.

Your are the best.

Peter

Extractor Patterns, Data Records and PHP Scripts?

Hi,

If you look on this page from our fourth tutorial:

[url]http://www.screen-scraper.com/support/tutorials/tutorial4/invoking_screen-scraper_from_php.php[/url]

you'll notice it links to a sample PHP file:

[url]http://www.screen-scraper.com/support/tutorials/tutorial4/php/shopping.php.txt[/url]

If you look through that PHP file, you'll notice a loop where it iterates over the contents of the DataSet:

<?
                // Iterate through each of the data records screen-scraper
                // extracted, outputting each of them to the browser.
                for&#40; $i = 0; $i < count&#40; $data_set &#41;; $i++ &#41;
                &#123;
?>
                        <tr>
                                <td><?= $data_set&#91;$i&#93;&#91;"TITLE"&#93; ?></td>
                                <td><?= $data_set&#91;$i&#93;&#91;"PRICE"&#93; ?></td>
                                <td><?= $data_set&#91;$i&#93;&#91;"MODEL"&#93; ?></td>
                                <td><?= $data_set&#91;$i&#93;&#91;"SHIPPING_WEIGHT"&#93; ?></td>
                                <td><?= $data_set&#91;$i&#93;&#91;"MANUFACTURED_BY"&#93; ?></td>
                        </tr>
<?
                &#125;
?>

Feel free to post a reply if I can clarify anything on that.

Kind regards,

Todd

Extractor Patterns, Data Records and PHP Scripts?

Hi Todd,

For clarification, I am invoking screen-scraper externally from a PHP script.

In my PHP script, I can use getVariable to get a data set (that was store as a session variable in a screen-scraper extractor pattern).

Once I have the data set, how do I extract the data from it (in my PHP script)? [I have searched through Tutorial 4 and can't find an explanation / example. Is it possible for you to provide a coding example?]

Thanks,
Peter

Extractor Patterns, Data Records and PHP Scripts?

Hi,

In answer to your questions:

1. If you want to work with them in scripts, yes. Our third tutorial touches on this ([url]http://www.screen-scraper.com/support/tutorials/tutorial3/tutorial_overview.php[/url]). It would also probably help you to read through our documentation on the dataSet object ([url]http://www.screen-scraper.com/support/docs/api_documentation.php[/url]).

2. You're correct. You can however, invoke screen-scraper externally from PHP. This is exemplified in our fourth tutorial ([url]http://www.screen-scraper.com/support/tutorials/tutorial4/tutorial_overview.php[/url]).

3. Our fourth tutorial should answer this for you.

Kind regards,

Todd Wilson