By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,570 Members | 1,284 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,570 IT Pros & Developers. It's quick & easy.

Help with extracting please folks.!

P: n/a
Help with extracting please folks.!
Hi. I have this:
a variable like: <a href="http://www.some_html.com/text.html" >some
text</a><br>

I heed to extract the "http://www.some_html.com/text.html " and put
it in var "link"
And extract "some text" and put it var "text",.

So basically extract all between <a href=" and " >
plus extract all between " > and </a><br>.
Any idea? Thank you all for your help. Gada finish this project
tonight, or I am totally screwed with my exams..:)

Sep 26 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
ki*******@hotmail.com said the following on 26/09/2005 23:34:
Help with extracting please folks.!
Hi. I have this:
a variable like: <a href="http://www.some_html.com/text.html" >some
text</a><br>

I heed to extract the "http://www.some_html.com/text.html " and put
it in var "link"
And extract "some text" and put it var "text",.

So basically extract all between <a href=" and " >
plus extract all between " > and </a><br>.
Any idea? Thank you all for your help. Gada finish this project
tonight, or I am totally screwed with my exams..:)


Please Google it.

http://www.google.co.uk/search?q=extract+urls+html+php
--
Oli
Sep 26 '05 #2

P: n/a
Didn't fined anything useful.:((

Sep 26 '05 #3

P: n/a
ki*******@hotmail.com wrote:
Didn't fined anything useful.:((


Look up preg_match and preg_match_all
Sep 26 '05 #4

P: n/a
kirill_uk wrote:
So basically extract all between <a href=" and " >
plus extract all between " > and </a><br>.


preg_match(
'`<a href="([^"]+)" >(.*?)</a><br>`',
$subject,
$output)

Disclaimer: in case of contact with arbitrary HTML, rinse immediately.

--
Jock
Sep 30 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.