Page 2 of 2 FirstFirst 1 2
Results 11 to 14 of 14
  1. #11
    Player

    Join Date
    Apr 2011
    Location
    Gridania
    Posts
    12
    This is very interesting. I'm going have to try out creating a web scraper.
    (0)

  2. #12
    Player

    Join Date
    Jun 2011
    Location
    Ul'duh
    Posts
    356
    Okay, so I've wrote a script that will take the info from the URL, and give you basic information about the character. The data is saved in variables so that you can input them into a database if you like.

    All you need to do is change the URL of the profile of the character you wish to see.

    <?php

    //-- This code is written by Astin Prey. Leader of Kisses and Kissed LS on Gysahl Server.
    //-- If you have any questions, you can simple send me a tell, or ask in a post on the forums @ www.kissesls.net

    $url = "http://lodestone.finalfantasyxiv.com/rc/character/status?cicuid=9060322";
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLOPT_USERAGENT, 'http://www.useragentstring.com/Firefox6.0_id_18845.php');
    curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept-Language: en-us,en;q=0.5'));
    $html = curl_exec($curl);
    curl_close($curl);

    $value = preg_match('/Sword<\/td><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $sword = $matches[1];

    $value = preg_match('/Axe<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $axe = $matches[1];

    $value = preg_match('/Archery<\/td><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $archery = $matches[1];

    $value = preg_match('/Hand\-to\-Hand<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $hand = $matches[1];

    $value = preg_match('/Polearm<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $polearm = $matches[1];

    $value = preg_match('/Shield<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $shield = $matches[1];

    $value = preg_match('/Conjury<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $conjury = $matches[1];

    $value = preg_match('/Thaumaturgy<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $thaumaturgy = $matches[1];

    $value = preg_match('/Woodworking<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $woodworking = $matches[1];

    $value = preg_match('/Armorcraft<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Armorcraft = $matches[1];

    $value = preg_match('/Leatherworking<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Leatherworking = $matches[1];

    $value = preg_match('/Alchemy<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Alchemy = $matches[1];

    $value = preg_match('/Smithing<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Smithing = $matches[1];

    $value = preg_match('/Goldsmithing<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Goldsmithing = $matches[1];

    $value = preg_match('/Clothcraft<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Clothcraft = $matches[1];

    $value = preg_match('/Cooking<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Cooking = $matches[1];

    $value = preg_match('/Mining<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Mining = $matches[1];

    $value = preg_match('/Fishing<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Fishing = $matches[1];

    $value = preg_match('/Botany<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Botany = $matches[1];

    echo "Sword: " . $sword;
    echo "<br/>";
    echo "Axe: " . $axe;
    echo "<br/>";
    echo "Archery: " . $archery;
    echo "<br/>";
    echo "Hand-to-Hand: " . $hand;
    echo "<br/>";
    echo "Polearm: " . $polearm;
    echo "<br/>";
    echo "Shield: " . $shield;
    echo "<br/>";
    echo "Conjury: " . $conjury;
    echo "<br/>";
    echo "Thaumaturgy: " . $thaumaturgy;
    echo "<br/>";
    echo "Woodworking: " . $woodworking;
    echo "<br/>";
    echo "Armorcraft: " . $Armorcraft;
    echo "<br/>";
    echo "Leatherworking: " . $Leatherworking;
    echo "<br/>";
    echo "Alchemy: " . $Alchemy;
    echo "<br/>";
    echo "Smithing: " . $Smithing;
    echo "<br/>";
    echo "Goldsmithing: " . $Goldsmithing;
    echo "<br/>";
    echo "Clothcraft: " . $Clothcraft;
    echo "<br/>";
    echo "Cooking: " . $Cooking;
    echo "<br/>";
    echo "Mining: " . $Mining;
    echo "<br/>";
    echo "Fishing: " . $Fishing;
    echo "<br/>";
    echo "Botany: " . $Botany;

    ?>

    Please don't be mean to me about the code. I'm 15, and not super good yet. I made this in a hurry, and I just thought I'd post it for users who need something similar
    (0)
    Last edited by alexi14; 11-09-2011 at 08:03 PM.


    KissesLinkshell of Gysahl
    www.KissesLS.net

  3. #13
    Player
    Aleczan's Avatar
    Join Date
    Aug 2011
    Location
    Ul'dah
    Posts
    535
    Character
    Aleczan Knighthill
    World
    Ragnarok
    Main Class
    Pugilist Lv 70
    Wow. Excellent. Let me try it!

    I can use codes and I can upload stuff/config my own blog/website, but there's no way I would be able to make the codes to work for a specific task like this, so nope I won't be mean at you. Thank you for sharing!
    (0)

  4. #14
    Player

    Join Date
    Jun 2011
    Location
    Ul'duh
    Posts
    356
    Hey, I've actually added to the code. Baisicly I didn't want users to need to tell me their profile URL to get the info on them. Instead I added some more code to do all that automaticly. All this needs is their first and last name. I've added a form where you can enter any player on the server and get their info, and then it shows it. this only works for my server though. You will need to change it if you want it to work for another server. just change the server name in the code


    <?php
    if($_POST['first'] == NULL)
    {
    ?>

    <html>
    <form method="post" action="scrape2.php">
    <input type="text" value="First Name" name="first" /> <input value="Last Name" type="text" name="last" /><input type="submit" value="Get Info" />
    </form>
    </html>

    <?php
    }
    else
    {
    $first = $_POST['first'];
    $last = $_POST['last'];

    $url = "http://lodestone.finalfantasyxiv.com/rc/search/search?q=" . $first . "+" . $last;
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLOPT_USERAGENT, 'http://www.useragentstring.com/Firefox6.0_id_18845.php');
    curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept-Language: en-us,en;q=0.5'));
    $html = curl_exec($curl);
    curl_close($curl);

    $value = preg_match('/href="\/rc\/character\/top\?cicuid=(\d+)">[^<]+<\/a><\/td><\/tr><\/table><\/td><td class="contents\-table1TD2" align="center">[^<]+<\/td><td class="contents\-table1TD1" align="center">Gysahl/', $html, $matches);
    $val = $matches[1];


    //-- This code is written by Astin Prey. Leader of Kisses and Kissed LS on Gysahl Server.
    //-- If you have any questions, you can simple send me a tell, or ask in a post on the forums @ www.kissesls.net

    $url = "http://lodestone.finalfantasyxiv.com/rc/character/status?cicuid=" . $val;
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLOPT_USERAGENT, 'http://www.useragentstring.com/Firefox6.0_id_18845.php');
    curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept-Language: en-us,en;q=0.5'));
    $html = curl_exec($curl);
    curl_close($curl);

    $value = preg_match('/Sword<\/td><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $sword = $matches[1];

    $value = preg_match('/Axe<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $axe = $matches[1];

    $value = preg_match('/Archery<\/td><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $archery = $matches[1];

    $value = preg_match('/Hand\-to\-Hand<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $hand = $matches[1];

    $value = preg_match('/Polearm<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $polearm = $matches[1];

    $value = preg_match('/Shield<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $shield = $matches[1];

    $value = preg_match('/Conjury<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $conjury = $matches[1];

    $value = preg_match('/Thaumaturgy<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $thaumaturgy = $matches[1];

    $value = preg_match('/Woodworking<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $woodworking = $matches[1];

    $value = preg_match('/Armorcraft<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Armorcraft = $matches[1];

    $value = preg_match('/Leatherworking<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Leatherworking = $matches[1];

    $value = preg_match('/Alchemy<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Alchemy = $matches[1];

    $value = preg_match('/Smithing<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Smithing = $matches[1];

    $value = preg_match('/Goldsmithing<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Goldsmithing = $matches[1];

    $value = preg_match('/Clothcraft<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Clothcraft = $matches[1];

    $value = preg_match('/Cooking<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Cooking = $matches[1];

    $value = preg_match('/Mining<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Mining = $matches[1];

    $value = preg_match('/Fishing<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Fishing = $matches[1];

    $value = preg_match('/Botany<\/t[dh]><td[^>]+><b>(\d+)<\/b>/', $html, $matches);
    $Botany = $matches[1];

    echo "Sword: " . $sword;
    echo "<br/>";
    echo "Axe: " . $axe;
    echo "<br/>";
    echo "Archery: " . $archery;
    echo "<br/>";
    echo "Hand-to-Hand: " . $hand;
    echo "<br/>";
    echo "Polearm: " . $polearm;
    echo "<br/>";
    echo "Shield: " . $shield;
    echo "<br/>";
    echo "Conjury: " . $conjury;
    echo "<br/>";
    echo "Thaumaturgy: " . $thaumaturgy;
    echo "<br/>";
    echo "Woodworking: " . $woodworking;
    echo "<br/>";
    echo "Armorcraft: " . $Armorcraft;
    echo "<br/>";
    echo "Leatherworking: " . $Leatherworking;
    echo "<br/>";
    echo "Alchemy: " . $Alchemy;
    echo "<br/>";
    echo "Smithing: " . $Smithing;
    echo "<br/>";
    echo "Goldsmithing: " . $Goldsmithing;
    echo "<br/>";
    echo "Clothcraft: " . $Clothcraft;
    echo "<br/>";
    echo "Cooking: " . $Cooking;
    echo "<br/>";
    echo "Mining: " . $Mining;
    echo "<br/>";
    echo "Fishing: " . $Fishing;
    echo "<br/>";
    echo "Botany: " . $Botany;
    }
    ?>
    (0)


    KissesLinkshell of Gysahl
    www.KissesLS.net

Page 2 of 2 FirstFirst 1 2