How to do this in php

Discussion in 'PHP' started by klkhosting, Aug 11, 2010.

  1. #1
    SERACH THE NAME :

    http://maplestory.nexon.net/Ranking...ld=0&job=0&pageIndex=1&key=XXXXXX&search=true

    XXXXXX= character name

    Obtaining results
    example SuperMario4

    Now obtain image from line 447

    output

    if' alt=""/></td>
    </body
     
    klkhosting, Aug 11, 2010 IP
  2. definitely

    definitely Well-Known Member

    Messages:
    520
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    160
    #2
    could you be a bit clear?
    if you want to extract a URL of an image from a page, then it is possible, but be clear, your post seems jumbled up

    regards
     
    definitely, Aug 11, 2010 IP
  3. klkhosting

    klkhosting Well-Known Member

    Messages:
    403
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    135
    #3
    Ok the imput box is this
    the name will be put were xxxxx are so in this case i want to search for jeffrey it would be like this
    Then on line 447 of the site the image is given in this format

     
    klkhosting, Aug 11, 2010 IP
  4. Narrator

    Narrator Active Member

    Messages:
    392
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    80
    #4
    Try this out:
    $keyword='Jeffrey';
    $data=file_get_contents('http://maplestory.nexon.net/Rankings/OverallRanking.aspx?type=overall&world=0&job=0&pageIndex=1&key='.$keyword.'&search=true');
    $pattern='|src\=\'(.*?)\' alt\=""/></td>\s*\n*\s*<td class\="char\-name">\s*'.$keyword.'</td>|';
    preg_match($pattern,$data,$match);
    $img_url=$match[1];
    PHP:
     
    Narrator, Aug 11, 2010 IP
  5. klkhosting

    klkhosting Well-Known Member

    Messages:
    403
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    135
    #5
    Ok Its not working do i need a html file for this?
     
    klkhosting, Aug 11, 2010 IP
  6. Narrator

    Narrator Active Member

    Messages:
    392
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    80
    #6
    It works perfect for me, what error are you getting?
    It is possible that file_get_contents() is blocked on your server.
     
    Narrator, Aug 12, 2010 IP
  7. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #7
    Would'nt say blocked, disabled.

    Can check if its been disabled via function_exists() or ini_get('disabled_functions')

    Furthermore if thats the case and you can't do anything to rectify it, consider using cURL.
     
    danx10, Aug 12, 2010 IP
  8. Mythotical

    Mythotical Well-Known Member

    Messages:
    36
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    111
    #8
    I would probably use cURL anyway as its 99% enabled on most servers.
     
    Mythotical, Aug 12, 2010 IP
  9. faizanafzal2

    faizanafzal2 Peon

    Messages:
    51
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Honestly speaking dude.. I didn't understand that what r u trying to say ???
     
    faizanafzal2, Aug 13, 2010 IP