/    Sign up×
Community /Pin to ProfileBookmark

Extracting data from webpages

Is it possible to extract text from a webpage with php? Like say i want to extract news headlines from a webpage if i know where it is, or temperature from a weather site.

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJan 23.2007 — Yes, it is possible. You could use file_get_contents() to grab the page as a string, then parse it with preg_match_all(), or perhaps use the [url=http://us2.php.net/manual/en/ref.domxml.php]DOM XML functions[/url] if running PHP5 and the target file is valid XHTML.
Copy linkTweet thisAlerts:
@kloon_zaauthorJan 23.2007 — K thanks, will check it out.
×

Success!

Help @kloon_za spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...