Current location: Hot Scripts Forums » Programming Languages » PHP » Problem with preg_match_all();


Problem with preg_match_all();

Reply
  #1 (permalink)  
Old 06-20-09, 05:54 AM
ArbStar ArbStar is offline
New Member
 
Join Date: Jan 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Problem with preg_match_all();

Hi,

I'm making a php page that helps me to get information from other pages,
1 part of the page run successfully,
but the other 2 parts doesn't work !

Here's the code:

PHP Code:

$data=file_get_contents("XXX"); // Here im getting the source of the file that i'll get the information from it

// first part
$t '/<input name="input2" size="100" value="(.+)" dir="ltr">/';  // the string im looking for
preg_match_all($t$data$inputt); // preg_match_all function
$inputt $inputt['0']['0']; // getting the first result

// second part
// same thing, but different string
$p '/<input name="input1" size="100" value="(.+)" dir="ltr">/';
preg_match_all($p$data$input);
$input $input['0']['0'];

// third part
// same thing but different string
$i '/<td rowspan="3"><img src="\.(.+)" border="1" height="150"><\/td>/';
preg_match_all($i$data$url);
$url $url['0']['0'];

echo 
$inputt;
echo 
$input;
echo 
$url
and as you see all the functions and variables are ok and there's no problems with them

but when we come to the output,
i just get the first part output

can you help me finding the mistake in this code

Last edited by ArbStar; 06-20-09 at 05:59 AM.
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 06-20-09, 10:30 AM
Jcbones Jcbones is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: North Carolina, USA
Posts: 516
Thanks: 5
Thanked 47 Times in 44 Posts
What do you mean by "the first part" ?

It will be difficult to help you, if there is no source file to try the RE against. We must see what it is doing...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


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
Pls help website problem! iangarrinud CSS 1 01-03-08 02:48 PM
login, roles problem dbrook007 ASP.NET 10 11-10-06 04:42 PM
Form Display Problem neevrap02 Visual Basic 1 09-05-06 06:18 AM
Count problem kasic ASP.NET 1 10-20-04 01:23 AM
Asp and Microsoft Access 2002 problem gop373 ASP 2 10-06-04 10:13 AM


All times are GMT -5. The time now is 02:31 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.