Results 1 to 4 of 4

Thread: How can i grab data from this php page?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2009
    Posts
    876

    How can i grab data from this php page?

    Hi guy's is it possible using php simply grab data from a php page?

    The php page looks like this...

    Code:
    {
             "id": "1486966978"
          },
          {
             "id": "1497131620"
          },
          {
             "installed": true,
             "id": "1509660136"
          },
          {
             "installed": true,
             "id": "1529210112"
          },
          {
             "id": "1569558425"
          },
          {

    what i want to do is make my php page check that page and only grab the ID's where it says installed:true and then echo them...

    (only want it to grab the numbers, if the page displays no installed:true, then it will display a message, saying no friends installed...


    Is this possible?

    Thanks
    Jamie

  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: How can i grab data from this php page?

    Looks like a JSON string. Maybe you could use the decode function: http://www.php.net/manual/en/function.json-decode.php


    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    May 2009
    Posts
    876

    Re: How can i grab data from this php page?

    Hi mate, what i am doing instead is getting the ID's from a xml document instead,
    The document looks like this...


    <uid>1509660136</uid>
    <uid>1529210112</uid>

    my php code is simply -


    Code:
    <?php
    $sxe = simplexml_load_file('path to xml');
    echo "$sxe->uid";
    ?>

    which works, however its only echoing the first uid like 1509660136.

    how can i change the code to echo each <uid> in the document, rather than just one?

    Thanks
    Jami

  4. #4
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: How can i grab data from this php page?

    Try this:
    PHP Code:
    <?php
    $sxe 
    simplexml_load_file('path to xml');

    foreach(
    $sxe->uid as $id)
    {
        echo 
    $id;
    }
    ?>

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

Posting Permissions

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



Click Here to Expand Forum to Full Width