Jump to content

Recommended Posts

Hello again, Freaks!

 

I stumbled upon a rather tedious problem that I've been trying to solve for quite some time now.

 

I play this browser-game which includes a lot of clicking so I made a menu (simple page that consists of two frames, one for the menu and one for the game itself) that holds links and forms to lessen the clicking on the actual game.

 

Now I've been trying to find a way to echo my characters HP etc. from the games profile-page to the menu but I can't access my profile-page with file_get_contents();, because it's required to be logged in to see the page.

 

So, after burying that idea I got a new one: Loading the profile page inside the menu frame as a hidden div that reloads every now and then, but I don't know how to find and echo the parts of text I want to, so if anyone could help me on how to echo a certain part of text on the same page the code is ran?

 

Sorry if I was confusing, feel free to ask for more details if needed,

- Bikkebakke

I really doubt I need that advanced stuff, all I need to do is pick a part of text, the first method I tried was:

 

<?php
$contents = file_get_contents('http://www.example.com');
$term_search="Search_term";
$no_term=1000;
$pos=strpos($contents, $term_search);
$pos += strlen($term_search);
$new_pos = substr($contents,$pos,$no_term);
echo $new_pos;
?>

 

But as of now I don't get the content from another location but from the very same file.

So like, is there a way to find text from the same file?

I.e.

<html-stuff>
<div that loads an page in it>
<more html-stuff>

<?php
//$fetch = script to fetch the contents of the previously mentioned <div>
echo $fetch;
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.