Jump to content

Mad_Coder

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Mad_Coder's Achievements

Newbie

Newbie (1/5)

0

Reputation

  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. Does it strip the devotional text properly? or just return the entire page?
  3. 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>'); */ ?>
  4. I know. I totally jumped the gun and it worked locally because get_file_contents is enabled, but when I uploaded it It errored out because I forgot to comment out that function. I will test your code and report back.
  5. 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.
  6. If you look above and my curl attempt, I'm trying get the page's content and strip the text only between these tags: $start_text2 = '<h1 class="dd-title">'; // get content starting after this tag $end_text2 = '</em>'; // and ending with this tag
  7. I can't. It exceeds the maximum length here and on phpaste.com. Here it is on my domain though: http://www.thestreamingbible.com/tmp/1.php It will no longer strip the output
  8. Yes, the page is returned, however it's not stripping the tags at all. And I can't figure out why.
  9. 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.
  10. 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.