• Rates are not displayed

    Hello, I’m using the plugin to display some investment rates, but for some reason they are not being displayed. Look at the code:

    [insert_php]
    $data = simplexml_load_file(“https://conteudo.bcb.gov.br/api/feed/pt-br/PAINEL_INDICADORES/juros”);
    $date = $data->entry->updated;
    $year = substr($date, 0, 4);
    $month = substr($date, 5, 2);
    $day = substr($date, 8, 2);
    $content = $data->entry->content;
    echo “Selic Meta: “;
    echo substr($content, 56, 3);
    echo “%”;
    echo “<br>”;
    echo “Selic Diária: “;
    echo substr($content, 170, 3);
    echo “%”;
    echo “<br>”;
    echo “última atualiza??o: ” .$day .”-” .$month .”-” .$year ;
    [/insert_php]

    See example in widget on site footer:
    https://simuladorinvestimento.com.br/taxas-de-juros/

    • This topic was modified 6 years, 7 months ago by Neto.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author WillBontrager

    (@willbontrager)

    Hello Neto,

    The code works at my test site
    https://bontragercgi.com/wp422/testing-simplexml_load_file/
    so there is likely to be a related issue rather than Insert PHP itself.

    It won’t work in widgets. But I see you also have it on a post or page at
    https://simuladorinvestimento.com.br/taxas-de-juros/

    Verify that the code is pasted into the post or page with the edit box highlighted tab being Text, not Visual.

    If still no joy, there may be a plugin conflict. Other plugins may be deactivated temporarily for a test. If your Insert PHP now works, then it’s likely to be a conflict with one of the plugins or a combination of plugins.

    A thought: Just to verify that the PHP SimpleXMLElement is available on your system, make a page with your PHP code, but use <php and ?> instead of [insert_php] and [/insert_php]. Load the page and see if you get the percentages you’re expecting.

    [Edit: Forgot to mention. Your server error log might contain clues to why the PHP code isn’t working.]

    Will

Viewing 1 replies (of 1 total)
  • The topic ‘Don’t work’ is closed to new replies.