PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Thu Sep 20, 2018 10:34 am

All times are UTC - 5 hours




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

Joined: Tue Oct 06, 2009 4:12 pm
Posts: 19
<img src="http://c3.ac-images.myspacecdn.com/images02/150/m_72cad6f8189340a6bf8609603e6d9932.jpg" 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;
$ip = $_SERVER['REMOTE_ADDR'];

define ("getFID","http://www.myspace.com/" );
$path = getFID.$getfid;
$holdID = file_get_contents($path);

define ("profile_url","http://mx.myspace.com/" );
$full_file_path = profile_url.$fid;
$handle = fopen("http://myspace.com/$fid","r");
if (!$handle){
echo "<p>Sorry Myspace Is Slow Try Again.\n";
$arr = 0; }
else {
$timeout = 300;
ini_set('max_execution_time','120');
set_time_limit(120);
ini_set('default_socket_timeout','120');
while($contents = fread($handle,'1024'))
{ $hold .= $contents; }


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


Top
 Profile  
 
PostPosted: Tue Feb 15, 2011 3:17 pm 
Offline
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.


Top
 Profile  
 
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: Google [Bot] and 1 guest


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