|
|
|
||||
|
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() |
|
|||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
|
Thread Tools |
|
|
#1 |
|
Confirmed User
Industry Role:
Join Date: Dec 2001
Posts: 7,952
|
PHP Help ...
How do I grab a certain word from a webpage?
For example PHP Code:
I know its seperated uniquely on the page by a <span class="blah">textiwant</span> Please help Thanks |
|
|
|
|
|
#2 |
|
Confirmed User
Industry Role:
Join Date: Apr 2006
Posts: 647
|
Best to use regular expressions with the preg_match function:
http://us2.php.net/manual/en/function.preg-match.php |
|
|
|
|
|
#3 |
|
Confirmed User
Join Date: Apr 2003
Location: Loveland, CO
Posts: 5,526
|
lookup the function
preg_match() and write a regular expression to grab your contents. Something like: $reg="/<.*>?(.*)<.*>/" or something like that. I haven't tried opening a url with "file_get_contents()" but you could try that instead of your loop, also.
__________________
Your post count means nothing. |
|
|
|
|
|
#4 |
|
Confirmed User
Join Date: May 2002
Location: Paying Webmasters Millions Since 1999
Posts: 4,044
|
This is what you want:
$contents = str_replace("textiwant", "replacementtext", $contents);
__________________
![]() Dirty D - ICQ #1326843 - $1 Million Dollars of Bonus Money - 8,000+ FHG! Glory Hole Girlz - Crack Whore Confessions - Tampa Bukkake - Slut Wife Training - Fuck a Fan Electricity Play - Porn Video Drive - Theater Sluts - Skunk Riley - Ukraine Amateurs - Strapon Sessions |
|
|
|
|
|
#5 | |
|
Clueless OleMan
Join Date: Mar 2003
Location: ICQ - 169903487
Posts: 11,009
|
Quote:
|
|
|
|
|
|
|
#6 | |
|
Confirmed User
Industry Role:
Join Date: Dec 2001
Posts: 7,952
|
Quote:
|
|
|
|
|
|
|
#7 |
|
Mostly retired
Industry Role:
Join Date: Apr 2006
Location: UK
Posts: 3,231
|
If you are hosting with DreamHost (who disallow file(), file_get_contents() and similar using URL wrappers - so you have to use CURL), use:
PHP Code:
PHP Code:
Hit me up on ICQ if you have any problems.
__________________
|
|
|
|
|
|
#8 | |
|
Confirmed User
Industry Role:
Join Date: Apr 2006
Posts: 647
|
Quote:
I think you misunderstood. He does not know what 'textiwant' is nor does he want to replace it. He wants to find what 'textiwant' is. |
|
|
|
|
|
|
#9 | |
|
Confirmed User
Industry Role:
Join Date: Dec 2001
Posts: 7,952
|
Quote:
Thanks, this worked .. Now I just have to play around to get the rest of it. |
|
|
|
|
|
|
#10 | |
|
CURATOR
Join Date: Jul 2004
Location: the attic
Posts: 14,572
|
2hp
__________________
tada! |
|
|
|
|
|
|
#11 |
|
Too lazy to set a custom title
Join Date: Jul 2003
Location: Netherlands
Posts: 10,127
|
some nice info
|
|
|
|
|
|
#12 | |
|
Mostly retired
Industry Role:
Join Date: Apr 2006
Location: UK
Posts: 3,231
|
Quote:
![]()
__________________
|
|
|
|
|