ID:               38715
 User updated by:  nino at recgr dot com
 Reported By:      nino at recgr dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         Network related
 Operating System: Windows XP
 PHP Version:      5.1.6
 New Comment:

I can't, it's private.

Well just try any pattern on any URL?


Previous Comments:
------------------------------------------------------------------------

[2006-09-05 18:51:02] [EMAIL PROTECTED]

Please provide REAL reproduce case without "<pattern>" and with exact
URL, so we can copy/paste and reproduce the problem.

------------------------------------------------------------------------

[2006-09-05 17:49:54] nino at recgr dot com

WORKING VERSION:

function grabData($page) {
$lookHere = file_get_contents($page);
preg_match("<pattern>", $lookHere, $found);
}

NON-WORKING VERSION:

function grabData($page) {
preg_match("<pattern>", file_get_contents($page), $found);
}

With that previous, non-working example, $found is an empty array,
while the first example works.

------------------------------------------------------------------------

[2006-09-04 20:19:31] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.



------------------------------------------------------------------------

[2006-09-04 19:43:16] nino at recgr dot com

Description:
------------
When you put file_get_contents('some_file.ext') as a second argument in
preg_match() it doesn't work. However, when you put that
file_get_contents() into a variable, and THEN you insert that variable
as a second argument, it works. At least at remote files (I'm not sure
about local files) and when there is a third argument too.

Reproduce code:
---------------
preg_match("<pattern>", file_get_contents('http://www.example.com'),
$found);

Expected result:
----------------
Found matches in array $found.

Actual result:
--------------
Nothing.
However, when put your script thus:

$url = file_get_contents('http://www.example.com');

preg_match("<pattern>", $url, $found);

then it works.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=38715&edit=1

Reply via email to