Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7907691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:34:52+00:00 2026-06-03T11:34:52+00:00

How to loop this thing to gather data of multiple $objectId? Like from $objectId

  • 0

How to loop this thing to gather data of multiple $objectId? Like from $objectId 1038 to 1048.

Below Im presentig full script that can collect data. In line $objectId = ""; //I want to gather info about IDs lets say from 1038 - 1048 should be the loop I think, but Ive failed to do it good.

<form name="myForm" action="" method="post" id="myForm">
  <table cellpadding="2" border="1">
    <tr>
      <td width="264" rowspan="2" valign="top"><?php 

    function transformHTML($string)
    {
        $string = trim($string);
        $string = utf8_decode($string);
        $string = htmlentities($string, ENT_NOQUOTES);
        $string = str_replace("#", "&#35;", $string);
        $string = str_replace("%", "&#37;", $string);

        return $string;
    }

    function get_string_between($string, $start, $end){
        $string = " ".$string;
        $ini = strpos($string,$start);
        if ($ini == 0) return "";
        $ini += strlen($start);
        $len = strpos($string,$end,$ini) - $ini;
        return substr($string,$ini,$len);
    }

    if($_POST['submit']) { 

        $objectId = ""; //I want to gather info about IDs lets say from 1038 - 1048

            $error_B = "<span class=error>Error #2:<br> Does the item exist (ID: " . $objectId . ")?</span><br>";

            $lines = file('http://services.runescape.com/m=itemdb_rs/viewitem.ws?obj=' . $objectId);
            foreach ($lines as $line_num => $line) {
                $lineCrawl = htmlspecialchars($line);
                $StringSum = "$StringSum$lineCrawl";
            }
            $parsedGuidePrice = get_string_between($StringSum, "Current guide price", "Today");
            $parsedItemName = get_string_between($StringSum, "&lt;title&gt;", " - Grand Exchange - RuneScape&lt;/title&gt;");
            $parsedItemIconUrl  = get_string_between($StringSum, '&lt;meta property=&quot;og:image&quot; content=&quot;', '&quot; /&gt;');

            $guideprice = preg_replace("/[^\.kbm0-9]/", "", $parsedGuidePrice);

            if (strpos($guideprice,'k') !== false) {
                $guideprice = preg_replace("/[^0-9]/", "", $parsedGuidePrice);
                $guideprice *= 100;
            } else if (strpos($guideprice,'m') !== false) {
                $guideprice = preg_replace("/[^0-9]/", "", $parsedGuidePrice);
                $guideprice *= 100000;
            } else if (strpos($guideprice,'b') !== false) {
                $guideprice = preg_replace("/[^0-9]/", "", $parsedGuidePrice);
                $guideprice *= 100000000;
            } 
            if ($guideprice == "") { 
                echo $error_B; 
            } else { 
                echo "<img src='" . $parsedItemIconUrl . "' class='parsedItemIconUrl'>";
                echo "<br>";
                echo "<strong>" . $parsedItemName . "</strong> guide price: <strong>" . $guideprice . "</strong>"; 
                echo "<br>";
                echo "<small>(Item ID: " . $objectId . ")</small><br><br><br>";
            }
    }
    ?></td>
      <td width="172"></td>
      <td width="99"><input type="submit" name="submit" alt="Get yesterday's averge market price" title="Get yesterday's averge market price"></td>
    </tr>
    <tr valign="top">
      <td></td>
      <td><input value="Reset" type="button" name="reset" alt="Reset the form" title="Reset the form" onClick="javascript:window.location = '';"></td>
    </tr>
  </table>
</form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T11:34:54+00:00Added an answer on June 3, 2026 at 11:34 am
    <form name="myForm" action="" method="post" id="myForm">
      <table cellpadding="2" border="1">
        <tr>
          <td width="264" rowspan="2" valign="top"><?php 
    
        function transformHTML($string)
        {
            $string = trim($string);
            $string = utf8_decode($string);
            $string = htmlentities($string, ENT_NOQUOTES);
            $string = str_replace("#", "&#35;", $string);
            $string = str_replace("%", "&#37;", $string);
    
            return $string;
        }
    
        function get_string_between($string, $start, $end){
            $string = " ".$string;
            $ini = strpos($string,$start);
            if ($ini == 0) return "";
            $ini += strlen($start);
            $len = strpos($string,$end,$ini) - $ini;
            return substr($string,$ini,$len);
        }
    
        function echoObjectIdStuff($objectId) {
            $error_B = "<span class=error>Error #2:<br> Does the item exist (ID: " . $objectId . ")?</span><br>";
    
            $lines = file('http://services.runescape.com/m=itemdb_rs/viewitem.ws?obj=' . $objectId);
            foreach ($lines as $line_num => $line) {
                $lineCrawl = htmlspecialchars($line);
                $StringSum = "$StringSum$lineCrawl";
            }
            $parsedGuidePrice = get_string_between($StringSum, "Current guide price", "Today");
            $parsedItemName = get_string_between($StringSum, "&lt;title&gt;", " - Grand Exchange - RuneScape&lt;/title&gt;");
            $parsedItemIconUrl  = get_string_between($StringSum, '&lt;meta property=&quot;og:image&quot; content=&quot;', '&quot; /&gt;');
    
            $guideprice = preg_replace("/[^\.kbm0-9]/", "", $parsedGuidePrice);
    
            if (strpos($guideprice,'k') !== false) {
                $guideprice = preg_replace("/[^0-9]/", "", $parsedGuidePrice);
                $guideprice *= 100;
            } else if (strpos($guideprice,'m') !== false) {
                $guideprice = preg_replace("/[^0-9]/", "", $parsedGuidePrice);
                $guideprice *= 100000;
            } else if (strpos($guideprice,'b') !== false) {
                $guideprice = preg_replace("/[^0-9]/", "", $parsedGuidePrice);
                $guideprice *= 100000000;
            } 
            if ($guideprice == "") { 
                echo $error_B; 
            } else { 
                echo "<img src='" . $parsedItemIconUrl . "' class='parsedItemIconUrl'>";
                echo "<br>";
                echo "<strong>" . $parsedItemName . "</strong> guide price: <strong>" . $guideprice . "</strong>"; 
                echo "<br>";
                echo "<small>(Item ID: " . $objectId . ")</small><br><br><br>";
            }
        }
    
        if($_POST['submit']) { 
            for($id = 1038;  $id <= 1048; $id++) {
                echoObjectIdStuff($id);
            }
        }
    
        ?></td>
          <td width="172"></td>
          <td width="99"><input type="submit" name="submit" alt="Get yesterday's averge market price" title="Get yesterday's averge market price"></td>
        </tr>
        <tr valign="top">
          <td></td>
          <td><input value="Reset" type="button" name="reset" alt="Reset the form" title="Reset the form" onClick="javascript:window.location = '';"></td>
        </tr>
      </table>
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I trying to create a loop with data from 2 tables, this thing is
I have a json object like this: [{ thing: Top, data: { childs: [{
I have the code below and I want to loop this every 5 seconds.
I have a loop like this: for i=1:no %some calculations fid = fopen('c:\\out.txt','wt'); %write
How can I loop through this json data without referring to the data items
I'm having trouble making this simple thing happen. I have this loop adding values
My project has a requirement to gather data from a number of sources, then
Usually code looks like this: (one-thing (another-thing arg1 (f arg5 r)) (another-thing arg1 (f
I have a Loop like this int numberofelements=20; for(int i=0;i<numberofelements;i++) { if(i==numberofelements) { break;
In scripting languages like PHP having a for loop like this would be a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.