scraperwiki / code-scraper-in-browser-tool

Just like on ScraperWiki Classic; now a part of QuickCode.
https://quickcode.io
Other
38 stars 8 forks source link

PHP Fatal error: Class 'scraperwiki' not found in /home/code/scraper #107

Closed michellec closed 11 years ago

michellec commented 11 years ago

I'm creating a scraper in PHP and I tried using the example here: https://classic.scraperwiki.com/docs/php/php_intro_tutorial but I keep getting the error "PHP Fatal error: Class 'scraperwiki' not found in /home/code/scraper" so it doesn't save the array since "scraperwiki" is used here "scraperwiki::save_sqlite(array('country'), $record);"

Is there a reason this is happening and is there a way to work around it?

zarino commented 11 years ago

Our PHP support is very minimal right now. There isn't a PHP "scraperwiki" library like there was in ScraperWiki Classic.

We're hoping that ScraperWiki's PHP community will all chip in and develop their own port of the Classic "scraperwiki" library – much as the Ruby users have over at https://github.com/scraperwiki/scraperwiki-ruby. If you don't mind donating a bit of time, and you think others might do the same, I'm happy to help publicise if you'd like to try organising the same for PHP.

Alternatively, we've heard good things about RedBean, which you can include by typing "require 'rb.php';" – we don't have any documentation for how to use it, but since it's a standard 3rd-party library, you should be able to find documentation and examples online.

michellec commented 11 years ago

Thanks for the help. Unfortunately, I'm not much of a developer (I'm still in the learning stage) so I don't think I have the skills to do much, but hopefully others will take initiative! I love the ease of ScraperWiki and will definitely continue experimenting with it.

rossjones commented 11 years ago

Is the best approach currently that someone could add https://bitbucket.org/ScraperWiki/scraperwiki-classic/src/e17cc2b0aa055e77f126132cb2aced1958c25463/scraperlibs/php?at=default to PHP Composer so that it is installable like the other libs?

frabcus commented 11 years ago

I would recommend trying to learn Python instead! For data science, it has much more powerful and well maintained modules than PHP does.

On Fri, Jul 12, 2013 at 09:12:22AM -0700, michellec wrote:

Thanks for the help. Unfortunately, I'm not much of a developer (I'm still in the learning stage) so I don't think I have the skills to do much, but hopefully others will take initiative! I love the ease of ScraperWiki and will definitely continue experimenting with it.


Reply to this email directly or view it on GitHub: https://github.com/frabcus/code-scraper-in-browser-tool/issues/107#issuecomment-20886733

Do you have an awesome idea you never quite manage to do? http://www.awesomefoundation.org/en/chapters/liverpool/

michellec commented 11 years ago

@frabcus Ah yes, I did try using Python but the website I'm scraping gives me a 500 error, so I'm using cURL to copy the page contents first. I tried searching for Python alternatives, but everything I've found makes me more confused, haha.

zarino commented 11 years ago

You'll be hard pressed to find anything simpler than Python Requests:

import requests

html = requests.get("https://scraperwiki.com").text
print html
# <!doctype html>…

json = requests.get("http://httpbin.org/get").json()
print json
# { 'url': 'http://httpbin.org/get', 'headers': { … } }