In some cases this works fine, in others like below, its not.
$xml_url = 'http://campusdining.compass-usa.com/Hofstra/Pages/SignageXML.aspx?location=Student%20Center%20Cafe';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $xml_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9.3a5pre) Gecko/20100526 Firefox/3.7a5pre");
$data = curl_exec($ch);
$ce = curl_error($ch);
curl_close($ch);
// this is how I was doing it prior to today and it worked before
// preg_match_all("/<MealPeriod name=\"(.+?)\">([\w\W\r\n]*?)<\/MealPeriod>/i", $data, $output_array);
// this way doesnt show all the meal periods,
// but I need to know whats in between the MealPeriod tags
// preg_match_all('/<MealPeriod name="(.*?)">(.*?)<\/MealPeriod>/i', $data, $output_array);
// shows all the meal period names,
// but I need the above to work to store whats in between the MealPeriod tags in the $output_array[2]
preg_match_all('/<MealPeriod name="(.*?)">/i', $data, $output_array);
echo '<pre> '.print_r($output_array[1],1).'</pre>';
I tried this on a few regex live sites and 1 of them returned what I needed, while the second did not..
http://www.phpliveregex.com/ -- did work
https://regex101.com/ -- did not work
expected output would by the following for $output_array[1]
:
Array
(
[0] => Breakfast
[1] => Every Day
[2] => Outtakes
[3] => Salad Bar
)
But it should also hold whats inbetween the MealPeriod tags in $output_array[2]
Any help would be greatly appreciated