PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
It is currently Sun Apr 21, 2019 6:10 pm

All times are UTC - 5 hours

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sun Feb 13, 2011 10:05 pm 
Forum Newbie

Joined: Tue Oct 06, 2009 4:12 pm
Posts: 19
<img src="" class="profilePic" alt="Photo of ıł♥νeчøυ(:" />

I NEED to use preg_match for this...
The img src will be different everytime and so will the alt.
here is the code i have so far but i cant seem to get it right... the only piece of info i need out of the string above is the img src
but once again... i need to find in with preg match in that certain string. please and thanks for any help

$fid = 178902;
$getfid = $fid;

define ("getFID","" );
$path = getFID.$getfid;
$holdID = file_get_contents($path);

define ("profile_url","" );
$full_file_path = profile_url.$fid;
$handle = fopen("$fid","r");
if (!$handle){
echo "<p>Sorry Myspace Is Slow Try Again.\n";
$arr = 0; }
else {
$timeout = 300;
while($contents = fread($handle,'1024'))
{ $hold .= $contents; }

preg_match("<img src=\"([^\">]+)\" class=\"profilePic\" alt=\".*?\" />",$hold,$match);

PostPosted: Tue Feb 15, 2011 3:17 pm 
Forum Contributor
User avatar

Joined: Thu May 11, 2006 8:58 pm
Posts: 305
Location: Utah, USA
Try putting a tilde around your string. PHP needs to see a delimiter (usually a slash but you have a slash in your regex) Also, add parentheses to capture the alt value. You may also want to take into consideration html with uppercase tag or attribute names, single quotes instead of double or without the self-closing slash.

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group