Results 1 to 4 of 4

Thread: read remote tag in remote content

  1. #1
    Join Date
    Jun 2010
    Posts
    11
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default read remote tag in remote content

    i can read remote tag but just one like following

    PHP Code:
    function get_title($url)
    {
        
    $title  '';
        
    $handle = @fopen("$url""r");
        
        if (
    $handle) {
            
    $i=0;
            while (!
    feof($handle)) {
                
    $i++;
                
    $buffer fread($handle8192);
                
    $buffer preg_replace("/\n|\r/"""$buffer);
                if (
    preg_match('/<li>(.*?)<\/u>/i'$buffer$matches)) {
                    
    $title $matches[$i];
                    break;
                }
            }
            
    fclose($handle);
        }
        return 
    $title;
    }

    echo 
    get_title("http://natural-fertility-info.com/fertility-herbs"); 
    but how can i read all data which is between <li><strong><u> and </u> in remote content
    Last edited by zodehala; 04-07-2013 at 09:53 PM.

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    PHP Code:
    preg_match_all"#<li><strong><u>([^(</u>)]*)</u>#ui",$buffer,$matches ); 
    the results you're looking for will be in $matches[1].

  3. #3
    Join Date
    Jun 2010
    Posts
    11
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    i change it into following but values is in html tags
    PHP Code:
    echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
    function 
    get_title($url)
    {
        
    $title  '';
        
    $handle = @fopen("$url""r");
        
        if (
    $handle) {        
            while (!
    feof($handle)) {            
                
    $buffer fread($handle8192);
                
    $buffer preg_replace("/\n|\r/"""$buffer);
                if (
    preg_match("#<li><strong><u>([^(</u>)]*)</u>#ui"$buffer$matches)) {
                    foreach (
    $matches as $a=>$b){
                        echo 
    $b."<br/>";
                            break;
                        }
                   }
            }
            
    fclose($handle);
        }
        return 
    $title;
    }

    echo 
    get_title("http://natural-fertility-info.com/fertility-herbs"); 
    source code is like following

    Code:
    <li><strong><u>Black Cohosh</u><br/><li><strong><u>Maca</u><br/><li><strong><u>Shatavari</u><br/><li><strong><u>Yarrow</u><br/><li><strong><u>Evening Primrose Oil</u><br/><li><strong><u>Shatavari</u><br/><li><strong><u>Ashwagandha</u><br/><li><strong><u>Castor Oil</u><br/><li><strong><u>Echinacea</u><br/><li><strong><u>Goldenseal</u><br/><li><strong><u>Red Raspberry</u><br/>
    how can i print just value ??

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by zodehala View Post
    i change it into following but values is in html tags

    [...]

    how can i print just value ??
    re-read my post.
    Quote Originally Posted by traq View Post
    the results you're looking for will be in $matches[1].

Similar Threads

  1. Tab Content Script - Remote Link
    By drmeisner in forum Dynamic Drive scripts help
    Replies: 15
    Last Post: 05-09-2014, 11:25 AM
  2. remote content in glider
    By funnelmarketing in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 10-02-2009, 02:10 AM
  3. [Tab Content Script (v 2.2)] Problem with remote link
    By coo in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 10-18-2008, 10:38 AM
  4. Replies: 6
    Last Post: 05-16-2008, 02:19 PM
  5. Referencing JS on remote
    By dbldee in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 08-13-2007, 09:39 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •