# Running Nokogiri in a simple task - getting data and storing it in sqlite db

**URL:** <https://www.ruby-forum.com/t/running-nokogiri-in-a-simple-task-getting-data-and-storing-it-in-sqlite-db/256942>\
**Category:** Uncategorized\
**Created:** [March 1, 2020, 1:26pm UTC](https://www.ruby-forum.com/t/running-nokogiri-in-a-simple-task-getting-data-and-storing-it-in-sqlite-db/256942 "2020-03-01T13:26:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![say\_hello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e480ec/32.png) [@say\_hello](https://www.ruby-forum.com/u/say_hello)\
**Post date:** [March 1, 2020, 1:26pm UTC](https://www.ruby-forum.com/t/running-nokogiri-in-a-simple-task-getting-data-and-storing-it-in-sqlite-db/256942/1 "2020-03-01T13:26:10Z")

</div>

hello dear Ruby-experts,

i fairly new to imple\_html\_dom usage and methods. I know a little the parser,  
i want to gather some information from this site:

> **[Database of European Voluntary Service accredited organisations | European...](https://youth.europa.eu/volunteering/organisations_en)**
>
> This lists the organisations accredited to run projects under European Voluntary Service - part of the European Union's Erasmus+ programme....

is this possible to get the content - of let us say 10 or 20 last records on that page - and subesquently to store it in my mysql - db!?

```
import requests
from bs4 import BeautifulSoup
 
url = 'https://europa.eu/youth/volunteering/organisations_en#open'
response = requests.get(url)
soup = BeautifulSoup(response.content, 'lxml')
print(soup.find('title').text)
block = soup.find('div', class_="eyp-card block-is-flex")

```

and this

```
European Youth Portal
>>> block.a
<a href="/youth/volunteering/organisation/50113_en" target="_blank">"Common Sense" Youth Organization PU</a>
>>> block.a.text
'"Academy for Peace and Development" Union'
 
>>> block.select_one('div > div > p:nth-child(9)')
<p><strong>PIC:</strong> 947847141</p>
>>> block.select_one('div > div > p:nth-child(9)').text
'PIC: 947847141'

```

i think creating this with Ruby is more efficient -  
the main goal is to get some of the first 20 results and to put it in a list or to store it in a sqlite-db

i also tried to do this in PHP … too

```
<?php
// Report all PHP errors (see changelog)
error_reporting(E_ALL);

include('inc/simple_html_dom.php');

    //base url
    $base = 'https://europa.eu/youth/volunteering/organisations_en#open';

    //home page HTML
    $html_base = file_get_html( $base );

    //get all category links
    foreach($html_base->find('a') as $element) {
        echo "<pre>";
        print_r( $element->href );
        echo "</pre>";
    }

    $html_base->clear(); 
    unset($html_base);

?>

```

I have the above code and I’m trying to get certain elements of the page but it isn’t returning anything.  
Is it possible that certain PHP functions might be disabled on the server to stop that?

The above code works perfectly on other sites.

Is there any workaround?
