TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 08-03-2008, 10:22 PM   #1 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default help with curl

im trying to figure out how to parse email addresses from a webpage
this is how far i got.

Code:
<?php 
$ch = curl_init(); 

curl_setopt($ch, CURLOPT_URL, 'http://www.google.com'); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); ;
$data = curl_exec($ch); 
curl_close($ch); 

?>
the variable $data holds the html source code and i tryed using preg_match to look for the email and print it out.
can someone show me a sample code on how to do this

thanks
__________________
no signature set
sarmenhb is offline  
Reply With Quote
Old 08-03-2008, 11:32 PM   #2 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

Quote:
im trying to figure out how to parse email addresses from a webpage
Well, first of all you need to.... HOLD UP. If I get any spam from any script you're about to write, I will cURL your address and egg your house, I promise.
-m
delayedinsanity is offline  
Reply With Quote
Old 08-04-2008, 03:31 AM   #3 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default

well, im not directly trying to make a email parser. im trying to figure out how to parse certain things.

for example if i wanted to parse out all the keywords that were used on a certain page. how do i display those out nicely on the screen.
__________________
no signature set
sarmenhb is offline  
Reply With Quote
Old 08-04-2008, 06:19 PM   #4 (permalink)
The Frequenter
Newcomer 
 
xenon's Avatar
 
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 438
Thanks: 3
xenon is on a distinguished road
Default

well...you parse the content Use regex if nothing else is available. What are we supposed to tell you?

PHP Code:
preg_match('/\b(.*?@.*?\.[a-z\.]{2,6})\b/si'$data$matches); 
This is the most basic regex you could use, I think.

PS: why did you open 2 threads for this?
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
xenon is offline  
Reply With Quote
Old 08-05-2008, 02:32 AM   #5 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default

no one was responding.

so basically the variable holds the html and i can use a loop to loop through it and output what i need right?
__________________
no signature set
sarmenhb is offline  
Reply With Quote
Old 08-05-2008, 08:42 PM   #6 (permalink)
The Frequenter
Newcomer 
 
xenon's Avatar
 
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 438
Thanks: 3
xenon is on a distinguished road
Default

Yes, you got it
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
xenon is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 01:35 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design