Visualizzazione dei risultati da 1 a 4 su 4
  1. #1
    Utente di HTML.it
    Registrato dal
    May 2008
    Messaggi
    34

    script per fare scraping​

    ho scaricato da internet uno script che permette di estrapolare i risultati di Google solo che quando l'ho installato sul mio sito mi dà un errore strano che allego:

    HTTP Error 500.0 - Internal Server Error
    C:\PHPVersions\PHP52\php-cgi.exe - The FastCGI process exited unexpectedly

    Most likely causes:
    •IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
    •IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
    •IIS was not able to process configuration for the Web site or application.
    •The authenticated user does not have permission to use this DLL.
    •The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.

    Things you can try:
    •Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.
    •Check the event logs to see if any additional information was logged.
    •Verify the permissions for the DLL.
    •Install the .NET Extensibility feature if the request is mapped to a managed handler.
    •Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.



    io ho uno spazio web su Aruba in Windows.

    allego anche lo script

    <?php
    include('simple_html_dom.php');
    error_reporting(0);
    function strip_tags_content($text, $tags = '', $invert = FALSE) {
    $text = str_ireplace('<br>', '', $text);
    preg_match_all('/<(.+?)[\s]*\/?[\s]*>/si', trim($tags), $tags);
    $tags = array_unique($tags[1]);
    if(is_array($tags) AND count($tags) > 0) {
    if($invert == FALSE) {
    return preg_replace('@<(?!(?:'. implode('|', $tags) .')\b)(\w+)\b.*?>.*?</\1>@si', '', $text);
    } else {
    return preg_replace('@<('. implode('|', $tags) .')\b.*?>.*?</\1>@si', '', $text);
    }
    } elseif($invert == FALSE) {
    return preg_replace('@<(\w+)\b.*?>.*?</\1>@si', '', $text);
    }
    return $text;
    }

    // inizio configurazione
    global $keyword; global $num; global $lingua;
    // $keyword può essere una variabile singola o un array in base alle esigenze
    // $num è il numero di risultati prelevati per ogni keyword
    // $lingua è la lingua in cui Google deve cercare
    $keyword = array("italia","spagna","marocco");
    $num = 20;
    $lingua = 'it';
    // fine configurazione
    function estrapolazione($key) {
    $q = urlencode(str_replace(' ', '+', $key));
    $r = '';
    global $keyword; global $num; global $lingua;
    if($num > 10) {
    $r = "&num=$num";
    }
    $data = file_get_html('http://www.google.com/search?hl=' .$lingua . '&q='.$q.$r);
    $html = str_get_html($data);
    $ris = array();

    foreach($html->find('li.g') as $g) {
    $h3 = $g->find('h3.r', 0);
    $s = $g->find('div.s', 0);
    if($h3 != ""){
    $a = $h3->find('a', 0);
    }
    $ris[] = array('title' => strip_tags($a->innertext),
    'link' => $a->href,
    'description' => strip_tags($s->innertext));
    }
    return $ris;
    }
    if($keyword) {
    if(is_array($keyword)) {
    $risultati = array();
    foreach($keyword as $k) {
    $test = estrapolazione($k);
    $risultati = array_merge($risultati,$test);
    }
    }
    else {
    $risultati = estrapolazione($keyword);
    }
    }
    // inizio output
    foreach($risultati as $r) {
    $riga = '"' . $r["title"] . '","' . $r["description"] . "\"\n";
    file_put_contents( "risultati.csv",$riga,FILE_APPEND);
    }
    // fine output
    $html->clear(); exit();
    ?>

  2. #2
    Aruba + Windows

    mi sa che devi farti configurare meglio il server, vedi anche qui cosa dicono: http://stackoverflow.com/questions/1...d-unexpectedly
    Questa volta, più che un voto.. è favoreggiamento.

  3. #3
    Utente di HTML.it
    Registrato dal
    May 2008
    Messaggi
    34
    ma non credo posso farlo io anche perché non saprei da dove iniziare
    se contatto​ Aruba e spiego il problema provvedono loro ?

  4. #4
    senti aruba e assicurati con loro che il supporto al php su windows tu l'abbia da hosting (una volta era opzionale) e che l'errore che riporti ( HTTP Error 500.0 - Internal Server Error C:\PHPVersions\PHP52\php-cgi.exe - The FastCGI process exited unexpectedly ) non sia per causa tua ma per causa della configurazione del server
    IP-PBX management: http://www.easypbx.it

    Old account: 2126 messages
    Oldest account: 3559 messages

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.