I need help in a code

Discussion in 'PHP' started by xM3talSkat3z16x, Oct 10, 2011.

  1. #1
    <?php
    if ( isset($_GET['show']) ){
    $show = $_GET['show'];
    } else if ( isset($_GET['e']) ){
    $e = $_GET['e'];
    } else {
    die('no input');
    }
    $x = "http://myanimelist.net/anime/$show";
    $i = file_get_contents($x);
    $id = "content";
    $raw = preg_match('/<div id=\"".$id."\">(.*?)</div>/',$i,$match);

    echo $raw;
    ?>
    i'm trying to grab whats inside the sypnosis info, and the picture by using php is this correct, it doesnt seem to be working.
     
    xM3talSkat3z16x, Oct 10, 2011 IP
  2. cro91

    cro91 Peon

    Messages:
    62
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Better explaining what you are trying to do would probably be best.

    Using the CODE tags (at the top of the posting box) will also help.
     
    cro91, Oct 11, 2011 IP
  3. ROOFIS

    ROOFIS Well-Known Member

    Messages:
    1,234
    Likes Received:
    30
    Best Answers:
    5
    Trophy Points:
    120
    #3
    Kinda hard to follow as cro91 said, have you echoed it out any of your booleans to see if they are returning anything? and not sure where $match comes into play either. You may need to post more of this script for a better view.
    -edit-
    just looking further on your code it appears that (and I'm assuming) a user can enter two types of input, $show and $e
    where $x = "http://myanimelist.net/anime/$show"; is not the case (false) there seems to be no alternative for $e
    ie: $y = "http://myanimelist.net/anime/$e"; which would require an if boolean statement to supplement.






    ROOFIS
     
    Last edited: Oct 11, 2011
    ROOFIS, Oct 11, 2011 IP
  4. JohnnySchultz

    JohnnySchultz Peon

    Messages:
    277
    Likes Received:
    4
    Best Answers:
    7
    Trophy Points:
    0
    #4
    i think you are trying to extract some text from another website, and you are finding it via regex..
    can you post a sample data from what the file_get_contents are retrieving?
     
    JohnnySchultz, Oct 12, 2011 IP
  5. xM3talSkat3z16x

    xM3talSkat3z16x Well-Known Member

    Messages:
    83
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    111
    #5
    xM3talSkat3z16x, Oct 21, 2011 IP