Passing a URL from a PHP script?
I am using a registered copy of screen-scraper professional 2.7.2.
I am invoking screen-scraper externally, from a PHP script, and I would like to pass a URL to screen scraper. (I am reading the URL from a file into the PHP script.)
Could you share the appropriate code to pass the URL to screen-scraper?
Appreciatively,
Peter
Passing a URL from a PHP script?
Hi Todd,
I would never have figured out the ~#URL#~ solution. It works wonderfully.
Many thanks,
Peter
Passing a URL from a PHP script?
Hi Peter,
You're correct that I'm referring to setting a session variable in your PHP code. That might look something like this:
$session->setVariable( "URL", "http://www.google.com/" );
And a more complete example of that can be found here:
[url]http://www.screen-scraper.com/support/tutorials/tutorial2/interacting_with_screen-scraper_from_php.php[/url]
Within screen-scraper, where you currently have hard-coded your URL in the "Properties" tab for your scrapeable file, you'll instead use something like this:
~#URL#~
similar to the example shown here:
[url]http://www.screen-scraper.com/support/tutorials/tutorial2/embedding_session_variables.php[/url]
When your scraping session runs, screen-scraper will swap the ~#URL#~ text for the corresponding session variable value (e.g., http://www.google.com/).
Feel free to write back if I can clarify further.
Kind regards,
Todd
Passing a URL from a PHP script?
Hi Todd,
I have looked at Tutorial 2 but I'm still not clear on what to do.
1. By "setting a session variable," do you mean a screen-scraper session variable? Where do I set it (in my PHP?)? How do I set it? - How do I tell screen-scraper to use the URL (please provide an example)?
2. To develop and test the scraping capability of a screen-scraper scrapeable file - I placed a permanent web address in the URL box on the Properties tab of the scrapeable file? How do I replace it with the URL that I read from a text file?
Confused,
Peter
Passing a URL from a PHP script?
Hi Peter,
You would do that by setting a session variable corresponding to the URL. We exemplify that in our second tutorial: [url]http://www.screen-scraper.com/support/tutorials/tutorial2/tutorial_overview.php[/url].
Kind regards,
Todd Wilson