Support » Plugin: PHP Code for posts » PHP code not working properly?

  • Hii There,

    I installed this plugin to see if I can get my PHP script to work (i’ve tried a few others, but none worked the way I needed them to).

    However, the output doesn’t show up at all, what is wrong?

    this is my code:
    `
    <?php
    function getKeybase($username){
    $url = “https://keybase.io/_/api/1.0/user/lookup.json?usernames=&#8221;. $username;
    echo $url;
    if(function_exists(‘curl_version’) == true){
    $cSession = curl_init();
    curl_setopt($cSession,CURLOPT_URL,$url);
    curl_setopt($cSession,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($cSession,CURLOPT_HEADER, false);
    $result=curl_exec($cSession);
    curl_close($cSession);
    }else{
    ini_set(“allow_url_fopen”, true);

    $result = file_get_contents($url);
    echo $result;
    }

    return $result;
    }

    $array = json_decode(getKeybase(“finlaydag33k”), true);

    if($array[‘them’][0][‘proofs_summary’][‘by_proof_type’][‘generic_web_site’]){
    ?>
    <ul>
    <?php
    foreach($array[‘them’][0][‘proofs_summary’][‘by_proof_type’][‘generic_web_site’] as $key => $value){
    ?>
    <li>
    <a href=”<?php echo htmlentities($value[‘proof_url’]); ?>” target=”_new”><?php echo htmlentities($value[‘nametag’]); ?></a> (<?php if($value[‘state’] == 1){?>Verified!<?php }else{?>Unverified!<?php } ?>)
    </li>
    <?php
    }
    ?>
    </ul>
    <?php
    }else{
    echo “Could not fetch websites!”;
    }
    ?>
    `

    Thanks

  • The topic ‘PHP code not working properly?’ is closed to new replies.