Jump to content

Mad_Coder

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Posts posted by Mad_Coder

  1. ::) ::)::) FINALLY !!!  ::) ::)::)

    - WORKS!

     

    <?php
    // Let's get the content
    $ch = curl_init("http://www.streamingfaith.com/prayer/devotionals");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    $source2 = curl_exec($ch);
    //echo $source2;
    
    
    $start_text2 = '<h1 class="dd-title">';
    $end_text2 = 'Scripture Of The Day:';
    
    $start_pos2 = strpos($source2, $start_text2) + strlen($start_text2);
    $end_pos2 = strpos($source2, $end_text2) - $start_pos2;
    $content = substr($source2, $start_pos2, $end_pos2);
    
    // let's strip the content
    $text = $content;
    //echo strip_tags($text);
    echo "\n";
    // Let's define Allowed tags and show it all
    echo strip_tags($text, '<p></p><br/><strong><em>');
    
    ?>
    

     

     

    THANKS FOR ALL YOUR HELP - AGIAN

  2. This doesn't work and I'm at a total loss. I can not for the life of me understand why.

     

    
    <?php
    // Let's get the content
    $ch = curl_init("http://www.streamingfaith.com/prayer/devotionals");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    $source2 = curl_exec($ch);
    
    $start_text2 = '<h1 class="dd-title">';
    $end_text2 = 'Scripture Of The Day:';
    $start_pos2 = strpos($source2, $start_text2) + strlen($start_text2);
    $end_pos2 = strpos($source2, $end_text2) - $start_pos2;
    $content = substr($source2, $start_pos2, $end_pos2);
    
    // let's strip the content
    $text = $content;
    //echo strip_tags($text);
    echo "\n";
    // Let's define Allowed tags and show it all
    echo strip_tags($text, '<p></p><br/><strong><em>');
    
    ?>
    

     

    However... I can retrieve the the page's content but it refuses to strip it

     

    <?php
    // Let's get the content
    $ch = curl_init("http://www.streamingfaith.com/prayer/devotionals");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    $source2 = curl_exec($ch);
    echo $source2;  // debug out only
    
    /*
    $start_text2 = '<h1 class="dd-title">';
    $end_text2 = 'Scripture Of The Day:';
    
    $start_pos2 = strpos($source2, $start_text2) + strlen($start_text2);
    $end_pos2 = strpos($source2, $end_text2) - $start_pos2;
    $content = substr($source2, $start_pos2, $end_pos2);
    
    // let's strip the content
    $text = $content;
    //echo strip_tags($text);
    echo "\n";
    // Let's define Allowed tags and show it all
    echo strip_tags($text, '<p></p><br/><strong><em>');
    */
    ?>
    

     

  3. I solved the problem. Here's my solution:

     

    
    <?php
    // Let's get the content
    $url = "http://www.streamingfaith.com/prayer/devotionals";
    $ch = curl_init($url);
    $source2 = curl_exec($url);
    
    $start_text2 = '<h1 class="dd-title">';
    $end_text2 = 'Scripture Of The Day:';
    $source2 = file_get_contents($url);
    $start_pos2 = strpos($source2, $start_text2) + strlen($start_text2);
    $end_pos2 = strpos($source2, $end_text2) - $start_pos2;
    $content = substr($source2, $start_pos2, $end_pos2);
    
    // let's strip the content
    $text = $content;
    //echo strip_tags($text);
    echo "\n";
    // Let's define Allowed tags and show it all
    echo strip_tags($text, '<p></p><br/><strong><em>');
    
    ?>
    
    THANKS FOR YOU HELP.
    

  4. I've been using this script to grab daily devotionals from our affilate for years, then our host disabled get_file_contents, I began porting to curl and it refuses to work and I can not figure out why? Be it... I'm not the best php developer (C# dev by trade) so I'm seeking the help from you pro's.

     

    // original get_file_file code

     

    <?php
    // Let's get the content
    $url = "http://www.streamingfaith.com/prayer/devotionals";
    $start_text2 = '<h1 class="dd-title">';
    $end_text2 = '</em>';
    $source2 = file_get_contents($url);
    $start_pos2 = strpos($source2, $start_text2) + strlen($start_text2);
    $end_pos2 = strpos($source2, $end_text2) - $start_pos2;
    $content = substr($source2, $start_pos2, $end_pos2);
    
    // let's strip the content
    $text = $content;
    //echo strip_tags($text);
    echo "\n";
    // Let's define Allowed tags and show it all
    echo strip_tags($text, '<p></p><br/><strong><em>');
    
    ?>
    

     

     

    // Now here's my attempt to curl - it refuses to strip the tags?

     

    <?php
    $ch = curl_init("http://www.streamingfaith.com/prayer/devotionals");
    $source2 = curl_exec($ch);
    
    $start_text2 = '<h1 class="dd-title">';
    $end_text2 = '</em>';
    
    $start_pos2 = strpos($source2, $start_text2) + strlen($start_text2);
    $end_pos2 = strpos($source2, $end_text2) - $start_pos2;
    $content = substr($source2, $start_pos2, $end_pos2);
    
    // let's strip the content
    $text = $content;
    
    //echo 
    strip_tags($text);
    echo "\n";
    // Let's define Allowed tags and show it all
    echo strip_tags($text, '<p></p><br/><strong><em>');
    
    ?>
    

     

    Please help.

  5. I have a site where the user must view a timed loader before playing an audio bible.  I'm noticing some direct linking to the bible player instead of sitting through the loader...

     

    I need to check the previous page's url before actually loading the player. I through together a script last ween in javascript and people reported error, so I assumed it would be best server side anyway.

     

    I haven't coded anything in PHP since PHP3.  So, I'm asking for your expert options and help...

     

    I haven't tested this yet, but is this the best method and are they any problems with this method (if it works).

     

    
    $realname = basename($_SERVER[loader], ".php");
    
    if ($realname == 'loader.php')
    {
       return();
    }
    
    else
    {
    // rediret to a notice to user that this isn't allow
    header( 'Location: http://www.yoursite.com/new_page.html' ) ;
    }
    
    
    

     

×
×
  • 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.