title: Extract the content of the script with PHP Simple HTML DOM
body: <p>I want to extract the content of the script on <a href="https://www.technolife.ir/product-3291/%DA%AF%D9%88%D8%B4%DB%8C-%D9%85%D9%88%D8%A8%D8%A7%D9%8A%D9%84-%D8%B3%D8%A7%D9%85%D8%B3%D9%88%D9%86%DA%AF-%D9%85%D8%AF%D9%84-galaxy-a12-nacho-%D8%B8%D8%B1%D9%81%DB%8C%D8%AA-128-%DA%AF%DB%8C%DA%AF%D8%A7%D8%A8%D8%A7%DB%8C%D8%AA---%D8%B1%D9%85-4-%DA%AF%DB%8C%DA%AF%D8%A7%D8%A8%D8%A7%DB%8C%D8%AA" rel="nofollow noreferrer">this page</a>, which has the ID <code>__NEXT_DATA__</code> using <code>PHP Simple HTML DOM</code>, the code I wrote is this:</p>
  <pre><code>foreach($html_base-&gt;getElementsByTagName('script') as $element) {
                  if (isset($element-&gt;id)){
                      $id = $element-&gt;id;
                      if ($id == &quot;__NEXT_DATA__&quot;){
                          $f = $element-&gt;nodeValue;
                          echo $f;
                          break;
                      }
                  }
              
              }
  </code></pre>
  <p>but unfortunately it gives me the following error:</p>
  <p><code>Undefined property: DOMElement::$id</code></p>