Jump to content
#FlattenTheCurve ×
Sign in to follow this  
dil_bert

ATOM - the editor:  unable to run php-script :: guess that i miss some php-indigriends on the Linux-machine

Recommended Posts

 dear experts, 

 

the issue in ATOM - the editor:  unable to run php-script :: guess that i miss some php-indigriends on the Linux-machine

well i guess that i need to set the php - 

note: i am on MX-Linux - and i can install all what is needed via terminal

 

    <?php
    include_once('../../simple_html_dom.php');

    function scraping_IMDB($url) {
        // create HTML DOM
        $html = file_get_html($url);

        // get title
        $ret['Title'] = $html->find('title', 0)->innertext;

        // get rating
        $ret['Rating'] = $html->find('div[class="general rating"] b', 0)->innertext;

        // get overview
        foreach($html->find('div[class="info"]') as $div) {
            // skip user comments
            if($div->find('h5', 0)->innertext=='User Comments:')
                return $ret;

            $key = '';
            $val = '';

            foreach($div->find('*') as $node) {
                if ($node->tag=='h5')
                    $key = $node->plaintext;

                if ($node->tag=='a' && $node->plaintext!='more')
                    $val .= trim(str_replace("\n", '', $node->plaintext));

                if ($node->tag=='text')
                    $val .= trim(str_replace("\n", '', $node->plaintext));
            }

            $ret[$key] = $val;
        }
        
        // clean up memory
        $html->clear();
        unset($html);

        return $ret;
    }


    // -----------------------------------------------------------------------------
    // test it!
    $ret = scraping_IMDB('http://imdb.com/title/tt0335266/');

    foreach($ret as $k=>$v)
        echo '<strong>'.$k.' </strong>'.$v.'<br>';

    ?>

 

whe i activate the Run in the scripts - then i get back the following ..:


 

 

    unable to run
    php
    Did you start Atom from the command line?
      atom .
    Is it in your PATH?
    PATH: /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin


well i guess that i need to set the php - 
note: i am on MX-Linux - and i can install all what is needed via terminal


look forward to your advices 

regards

 

´dil_bert

 

btw: i want to install vscode on MX-Linux - if you have any ideas & hints - i would be more than glad. - just contact me#!

Share this post


Link to post
Share on other sites

ahh hi there - just another question - this fits here very well - i guess that i do not need to open a new thread...

 

i have added Script-package -which works fine.

 

all is well now: one question:

 

running Python-Script: with script-pagage: where to see the output - where can i see the output of the script!?

i haver the screens divided and all i see is the following:

 

 

[Finished in 3.141s]

 

 

this is the script:

 

from bs4 import BeautifulSoup
import urllib

url = urllib.urlopen('http://meinparlament.diepresse.com/')
content = url.read()
soup = BeautifulSoup(content, 'lxml')

table = soup.findAll('div',attrs={"class":"content-question"})
for x in table:
    print x.find('p').text

# Another way to retrieve tables:
# table = soup.select('div[class="content-question"]')

 

see my screen ... how all is organized... - the question is:  how can i arrange the whole ATOM so that i can see 

 

a, the script 

b. the command-line and 

c. the output!?  .... which means - the output of the little bs4-script...

 

 

love to hear from you.. 

regards 

 

see the script: 

 

image.thumb.png.b9e04ed18cbc0fc721b1f116e297783d.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.