NavigationUser loginscreen-scraper.com welcomes...
Currently online
There are currently 0 users and 1 guest online.
|
Tutorial 4: Page 3: Invoking screen-scraper from PHP
Before we dig into the code let's review a few things related to invoking screen-scraper via PHP. First, your PHP code will need to refer to screen-scraper's PHP driver, called "remote_scraping_session.php". You can find this file in the "misc\php\" folder of your screen-scraper installation. You'll want to put a copy of that file into the directory where you plan on putting the PHP file that will invoke screen-scraper. In order to invoke screen-scraper from PHP, screen-scraper needs to be running in server mode. If you'd like a refresher on how to start up screen-scraper in server mode go ahead and follow that link, then come back here. Okay, let's try it out before we go over the code. Download the shopping.php.txt file here, then save it in the same directory where you copied the "remote_scraping_session.php" file. Rename the file from "shopping.php.txt" to "shopping.php". After that start up screen-scraper in server mode. Open up your web browser and go to the URL corresponding to the "shopping.php" file (e.g, http://localhost/screen-scraper/shopping.php). You'll see a simple search form. Type in a product keyword, such as "bug", then hit the "Go" button. If all goes well the page will take a little while to load (it's waiting as screen-scraper extracts the data), then it will output the corresponding products. If that didn't go quite as you expected here are some things to check:
Assuming that test worked, fire up your favorite PHP editor and open the "shopping.php" file in it. The file is pretty heavily commented, so hopefully it makes sense what's going on. If not, try reviewing PHP documentation, posting to our forum, or sending us a support request. When you invoke screen-scraper as a server it creates log files corresponding to your scraping session in its "log" folder. Take a look in that folder for your "Shopping Site" log file and take a look through it. It should look similar to what you see when you run scraping sessions in the workbench.
|
SearchNew Video!Tags Throughout this Site |
Recent comments
6 hours 14 min ago
6 hours 21 min ago
8 hours 28 min ago
1 day 3 hours ago
1 day 4 hours ago
1 day 4 hours ago
1 day 5 hours ago
1 day 5 hours ago
1 day 5 hours ago
3 days 2 hours ago