Results 1 to 10 of 16
Threaded View
-
26th May 2011, 08:36 PM #1OPMember
A doubt about php's preg_match result.
So, I have this html file that basicaly says:
PHP Code:echo '<table>
<tr>
<td>Welcome to:</td>
<td><strong>Hell</strong></td>
</tr>
</table>';
Now, I have another php file that (should) gets (through CURL and preg_match) the "<strong>Hell</strong>" part:
Curl Result ends in the var: $Result
Pattern I want to match against the $Result: $pattern = '/ <td>Welcome to\:<\/td>
<td>(.*)<\/td>/m';
Preg Match result var: $pregResult
PHP Code:preg_match ($pattern, $Result, $pregResult)
PHP Code:array(0) { }
So, can anyone point me to what is going on wrong because I am out of ideas.
My setup is windows + XAMPP with phpversion 5.3.5.
PC
Here are the actual php files:
-------------- test.php ------------
PHP Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
echo '<table width="50%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Welcome to:</td>
</tr>
<tr>
<td><strong>Hell</strong></td>
</tr>
</table>';
?>
</body>
</html>
PHP Code:<?php
error_reporting(-1);
$curlTarget = "http://127.0.0.1/multiline/test.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$curlTargget);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result = curl_exec ($ch);
curl_close($ch);
$patternCoiso = '/ <td>Welcome to:<\/td>
<td>(.*)<\/td>/mi';
preg_match($patternCoiso, $result, $match);
var_dump($match);
?>PCManiac Reviewed by PCManiac on . A doubt about php's preg_match result. So, I have this html file that basicaly says: echo '<table> <tr> <td>Welcome to:</td> <td><strong>Hell</strong></td> </tr> </table>'; (whether this code is or not valid, does not matter.. Is just of the sake of having an example) Rating: 5
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Looking for Exam Result Script
By DevilLnC in forum Web Application/Script SupportReplies: 5Last Post: 7th Feb 2014, 02:04 PM -
Need help with google search result
By .nItIsH. in forum Webmaster DiscussionReplies: 4Last Post: 4th Mar 2012, 07:54 AM -
preg_match help need!
By saninokia in forum Web Development AreaReplies: 8Last Post: 27th Nov 2011, 08:39 PM -
Why Google Result Going Down!!
By indianmoviefans.info in forum Webmaster DiscussionReplies: 13Last Post: 23rd Sep 2011, 08:00 AM -
Help with preg_match - php !
By softleaks in forum Webmaster DiscussionReplies: 5Last Post: 21st May 2011, 04:22 PM
themaManager - edit and manage...
Version 3.94 released. Open older version (or...