How could I use findtext or any proc actually to find out if a BYOND member page is real. Like I'm trying to make it say,
"Sorry this key does not exist". Perhaps there is a way I could?
ID:159637
Feb 5 2009, 3:15 am
|
|
In response to Andre-g1
|
|
I tried it but I need a core difference, like some text that stands out that wouldn't be anywhere, unless you're suggesting I have a very, very, extremely long if proc.
|
You could actually compare text+html, as in say you've imported the source and found that it says
//just for readability <div class="big_box"> Then the chances are that they're on the member page since the page was not found. Something like that as I doubt ANY page will have that. Just findtext for something like that. Things that don't change on the members page. |
In response to Haywire
|
|
Would I have to html_decode the page first?
var/website = world.Export("http://byond.com/members/[named]") |
In response to Choka
|
|
Arghh, I don't remember correctly, but if you save the exported data into a list you can access the source via listname["CONTENT"] or listname["CONTENTS"]. Correct my if I'm wrong.
|
In response to Haywire
|
|
If I converted it into a list then I'd be using find() instead of findtext() and I'd also be doing something COMPLETELY different.
|
In response to Choka
|
|
Noo, if you made it a list you can access the "CONTENT" index. Hold on, give me a minute I'll check something.
|
In response to Choka
|
|
This seems to work:
var |
In response to Haywire
|
|
Thanks a trillion! I've been trying on that for a long time.
|
In response to Haywire
|
|
It really doesn't matter if he "made it a list" (assuming "define its var as of /list type"), since it gets set into a list anyway and accessing an index or key doesn't require any typecasting at compile-time. So you could do the same anyway:
var/website = world.Export(...) You could define the website var as an /obj if you felt like it, it doesn't matter. It doesn't affect the data of the var. |
In response to Kaioken
|
|
Thank you for the information.
|
You can easily do this by using the text-formatted member page, if the content-type header is plain text they exist, if the content-type header is html they don't (as it would return the HTML front page).
mob |
If it's the same, the key doesn't exist.