• Resolved ava95

    (@ava95)


    I am currently using WP Web Scraper version 3.2. Once I insert the shortcode or template tag (php code) directly into my page, the plugin works perfectly fine and the values appear. I decided to place the template tag in an external php file and use Ajax to call the code after a specific amount of time, and once I do so nothing appears and my console shows 500 (Internal Server Error). I get a message which says “Failed to load resource”. My php file (test.php) looks contains this (assuming that URL is the actual link to the website):

    <?php
    echo wpws_get_content('URL', 'body > table > tbody > tr:nth-child(1) > td:nth-child(8)' );

    On my page, I use Javascript to load this file and it looks like this:

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <script>
    $(document).ready( function() {
    setInterval(function () {
        $('#demo').fadeOut('slow', function() {
            $('#demo').load('https://localhost:8888/test-site/wp-content/my-php-files/goldprice.php', function() {
                $('#demo').fadeIn('slow');
            });
        });
    }, 6000);
    });
    </script>
    
    <div id="demo"></div>

    I tested the PHP file with other codes to check if they work and they work perfectly fine. One example of php I inserted in that file was:

    <?php
    echo(rand(10,100));

    In this last example, using my script, a random number is loaded from the external file every 6 seconds without having to refresh the page and I get no errors. I deduced from this the template tag provided by the plugin is causing the problem. How can I load this template tag into my script? Any suggestions?

    King regards!!

    https://www.ads-software.com/plugins/wp-web-scrapper/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘500 (Internal Server Error) o external php file’ is closed to new replies.