title: How to Grab a String from This to That from a Webpage's Source?
body: <p>How to grab a string from this to that from a webpage's source? I have looked all over PHP.net and I was not able to figure out if PHP had a function or set of functions that can grab a string from this to that.</p>
  
  <p>For example, this is what I currently have (and I want to grab everything from <code>"wgCategories"</code> to <code>"wgMonthNamesShort"</code>) from the webpage stored in <code>$html</code>:</p>
  
  <pre><code>&lt;?php
  error_reporting(E_ALL);
  $html = file_get_contents('http://en.wikipedia.org/wiki/Los_Angeles');
  $string = &lt;&gt;;
  ?&gt;
  </code></pre>
  
  <p>First, I grabbed the webpage's source into the $html variable. Now I need a function or set of functions that can grab everything from <code>"wgCategories"</code> to <code>"wgMonthNamesShort"</code> and store it into $string.</p>
  
  <p>Desired result:</p>
  
  <pre><code>$string = "wgCategories":["All articles with dead external links","Articles with dead external links from March 2013","Articles with dead external links from March 2014","Pages with broken reference names","Articles with dead external links from January 2014","Articles with dead external links from September 2011","Articles with dead external links from October 2011","CS1 errors: dates","Use mdy dates from May 2014","Wikipedia indefinitely semi-protected pages","Wikipedia indefinitely move-protected pages","Coordinates on Wikidata","Articles including recorded pronunciations","Articles containing Spanish-language text","All articles with unsourced statements","Articles with unsourced statements from December 2013","Spoken articles","Articles with hAudio microformats","Los Angeles, California","Cities in Los Angeles County, California","Communities on U.S. Route 66","County seats in California","Incorporated cities and towns in California","Populated coastal places in California","Populated places established in 1781","Port cities and towns of the United States Pacific coast","Butterfield Overland Mail in California","Stockton - Los Angeles Road"],"wgBreakFrames":false,"wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgMonthNamesShort";
  </code></pre>
  
  <p>Lastly, please note that everything from <code>"wgCategories"</code> to <code>"wgMonthNamesShort"</code> is stored in between <code>&lt;script&gt;</code> tags (Not sure if this is important, but someone told me it is worth mentioning).</p>
  
  <p>Let me know if clarification is needed.</p>