Current location: Hot Scripts Forums » Programming Languages » PHP » Preg_Match error


Preg_Match error

Reply
  #1 (permalink)  
Old 11-04-09, 01:14 AM
vincemz vincemz is offline
New Member
 
Join Date: Nov 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Preg_Match error

I'm trying to get this MySpace train script to work, and I've been trying to use preg_match, to fetch the picture so it will post the user, and add their picture to the MySQL Database, to show on the train.

But, when I do it, it cannot find a match, so it won't register correctly.

Any idea what's wrong?

Preg_Match:
Code:
		preg_match("/<a type=\"text\/javascript\" id=\"ctl00_cpMain_ctl00_UserBasicInformation1_hlDefaultImage\" rel=\"searchMonkey-photo\" href=\"http:\/\/viewmorepics.myspace.com\/index\.cfm\?fuseaction=user\..*?friendID=$fid\">.*?<\s*img [^\>]*src=\"([^\">]+)/is",$hold,$match);
Full Code:
Code:
define ("profile_url","http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendID=" );
$full_file_path = profile_url.$fid;
$handle = fopen($full_file_path,"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("/<a id=\"ctl00_cpMain_ctl00_UserBasicInformation1_hlDefaultImage\" rel=\"searchMonkey-photo\" href=\"http:\/\/viewmorepics.myspace.com\/index\.cfm\?fuseaction=user\..*?friendID=$fid\">.*?<\s*img [^\>]*src=\"([^\">]+)/is",$hold,$match);
	$pic_url = $match[1];
preg_match("/<span class=\"nametext\">(.*)<br \/>/",$hold,$match);
$name = $match[1];
		if(empty($pic_url))
		{
		preg_match("/<a type=\"text\/javascript\" id=\"ctl00_cpMain_ctl00_UserBasicInformation1_hlDefaultImage\" rel=\"searchMonkey-photo\" href=\"http:\/\/viewmorepics.myspace.com\/index\.cfm\?fuseaction=user\..*?friendID=$fid\">.*?<\s*img [^\>]*src=\"([^\">]+)/is",$hold,$match);

		$pic_url = $match[1];
		}
		if(empty($name))
		{
		preg_match("/<span class=\"nametext\">(.*)<\/span>/",$hold,$match);
		$name = $match[1];
		}
		
		fclose($handle);
		ini_restore('max_execution_time');
		ini_restore('default_socket_timeout');
		if(empty($pic_url))
		{ ?>
<script language="javascript"><!--
alert("Invalid ID!")
location.replace("index.php")
//-->
Any help would be appreciated!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-04-09, 04:42 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Please post an example of the string you're trying to match.
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks

Tags
add, myspace, php, preg_match, train


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ and MSSQL tutorials? scott2500uk C/C++ 8 05-11-09 03:33 AM
[SOLVED] 500 Internal Server Error - Please help Dawn Perl 15 07-08-08 12:08 PM
Syntax Error Nikas Database 4 05-15-08 11:48 AM
server error in ' / ' application vikkygupta2005 ASP.NET 1 11-10-06 07:07 AM
ASP upload prob minority ASP 1 06-27-05 09:35 AM


All times are GMT -5. The time now is 08:36 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.