Problems Invoking Screen-Scraper From PHP
Hello,
I'm trying to use screen-scraper with PHP. I have the remote_scraping_session.php file in the same folder as my scrape2.php (this is my test file). I have not made any changes to remote_scraping_session.php.
Here is my screen-scraper setup:
===============================
PROXY SESSIONS
-IGNXBOX
SCRAPING SESSIONS
-IGNXBOX
-ign2
-IGNXBOX
===============================
Source Code for scrape2.php:
include ('remote_scraping_session.php');
$session = new RemoteScrapingSession;
$session->initialize( "ign2" );
$topic = $session->getVariable( "TOPIC" );
$session->scrape();
echo "Topic: " . $session->getVariable( "TOPIC" ) . "
";
$session->disconnect();
?>
When I run this script, I get the following error:
An IOException occurredc. The message was: Software caused connection abort: recv failed
java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder$CharsetSD.implRead(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.BufferedReader.fill(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at com.screenscraper.scraper.RemoteScrapingSessionHandler.run(RemoteScrapingSessionHandler.java:164)
I have the screen-scraper proxy server running as a service on WinXP Pro.
Can anyone help me with this?
Thanks in advance,
Trent
Problems Invoking Screen-Scraper From PHP
tcollie,
If Java is reporting a MalformedURLException, then my first to guesses are that either you need to try running the session within the screen-scraper gui to make sure that everything is working or that there is a variable that you need to set before calling scrape because it is part of the URL. If neither of these seem to be the case than I would be surprised. PHP in this case is not using URLs to call screen-scraper.
Let me know if you get it working from these suggestions, or if I can be of any more assistance.
Brent
screen-scraper.com
Errors
I think I was calling the wrong session so I changed my PHP script to call IGNXBOX as the scraping session and I received the following error:
no protocol: /news(Unknown Source)(Unknown Source)(Unknown Source)(HTTPRequest.java:279)
java.net.MalformedURLException: no protocol: /news
at java.net.URL.
at java.net.URL.
at java.net.URL.
at com.screenscraper.common.HTTPRequest.
at com.screenscraper.scraper.ScrapeableFile.scrapeData(ScrapeableFile.java:2786)
at com.screenscraper.scraper.ScrapeableFile.scrape(ScrapeableFile.java:1891)
at com.screenscraper.scraper.ScrapingSession.scrapeFile(ScrapingSession.java:1396)
at com.screenscraper.scraper.Scraper.scrape(Scraper.java:176)
at com.screenscraper.scraper.Scraper.standardScrape(Scraper.java:96)
at com.screenscraper.scraper.ScrapingSession.startScraping(ScrapingSession.java:1172)
at com.screenscraper.scraper.RemoteScrapingSessionHandler.run(RemoteScrapingSessionHandler.java:345)
I also received a "Null" response in my data request, where normally it just shows a blank area, so I think I'm closer to getting it to work now.
I also used the upgrade function and I upgraded my version before I ran this script again. I'm using version 1.5.1.4a now.
Problems Invoking Screen-Scraper From PHP
tcollie,
In looking over your e-mail it looks like everything is correct. I even copied your php script and tried it. It worked fine for me on my Windows XP machine. Are you sure that you have screen-scraper listening on the correct port? Did you try it again to see if it was a fluke? Also, what version of screen-scraper are you running?
If you wanted me to look over your specific setup you could export your scraping session and send it to me to give it a try.
Good luck getting things running,
Brent
screen-scraper.com