3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = 'http://beta.congress.gov/search?pageSort=dateOfIntroduction%3Adesc&q={%22congress%22%3A%22112|113|111|110|109|108|107|106%22%2C%22source%22%3A%22legislation%22}&pageSize=25'; libxml_use_internal_errors(true); $dom = new DOMDocument; $dom->loadHTMLFile($url); header('content-type: text/plain'); $xpath = new DOMXPath($dom); $found = $xpath->query('//ul[@class="results_list"]/li'); $results = array(); foreach ($found as $li) { $bill = $xpath->query('h2/a', $li); $bill_name = $bill->item(0)->nodeValue; $bill_url = $bill->item(0)->getAttribute('href'); $sponsor = $xpath->query('table/tbody/tr/td/a', $li); $sponsor_name = $sponsor->item(0)->nodeValue; $sponsor_url = $sponsor->item(0)->getAttribute('href'); $results[] = array( $bill_name => $bill_url, $sponsor_name => $sponsor_url ); } var_dump($results);
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: DOMDocument::loadHTMLFile(): php_network_getaddresses: getaddrinfo for beta.congress.gov failed: System error in /in/XDqLS on line 7 Warning: DOMDocument::loadHTMLFile(http://beta.congress.gov/search?pageSort=dateOfIntroduction%253Adesc&q=%7B%2522congress%2522%253A%2522112%7C113%7C111%7C110%7C109%7C108%7C107%7C106%2522%252C%2522source%2522%253A%2522legislation%2522%7D&pageSize=25): Failed to open stream: php_network_getaddresses: getaddrinfo for beta.congress.gov failed: System error in /in/XDqLS on line 7 Warning: Cannot modify header information - headers already sent by (output started at /in/XDqLS:7) in /in/XDqLS on line 9 array(0) { }
Output for 8.0.13 - 8.0.30
Warning: DOMDocument::loadHTMLFile(): php_network_getaddresses: getaddrinfo failed: System error in /in/XDqLS on line 7 Warning: DOMDocument::loadHTMLFile(http://beta.congress.gov/search?pageSort=dateOfIntroduction%253Adesc&q=%7B%2522congress%2522%253A%2522112%7C113%7C111%7C110%7C109%7C108%7C107%7C106%2522%252C%2522source%2522%253A%2522legislation%2522%7D&pageSize=25): Failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/XDqLS on line 7 Warning: Cannot modify header information - headers already sent by (output started at /in/XDqLS:7) in /in/XDqLS on line 9 array(0) { }
Output for 8.0.0 - 8.0.12
Warning: DOMDocument::loadHTMLFile(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/XDqLS on line 7 Warning: DOMDocument::loadHTMLFile(http://beta.congress.gov/search?pageSort=dateOfIntroduction%253Adesc&q=%7B%2522congress%2522%253A%2522112%7C113%7C111%7C110%7C109%7C108%7C107%7C106%2522%252C%2522source%2522%253A%2522legislation%2522%7D&pageSize=25): Failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/XDqLS on line 7 Warning: Cannot modify header information - headers already sent by (output started at /in/XDqLS:7) in /in/XDqLS on line 9 array(0) { }
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.30, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.6, 7.3.12, 7.3.32 - 7.3.33, 7.4.0, 7.4.26 - 7.4.33
Warning: DOMDocument::loadHTMLFile(): php_network_getaddresses: getaddrinfo failed: System error in /in/XDqLS on line 7 Warning: DOMDocument::loadHTMLFile(http://beta.congress.gov/search?pageSort=dateOfIntroduction%253Adesc&q=%7B%2522congress%2522%253A%2522112%7C113%7C111%7C110%7C109%7C108%7C107%7C106%2522%252C%2522source%2522%253A%2522legislation%2522%7D&pageSize=25): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/XDqLS on line 7 Warning: Cannot modify header information - headers already sent by (output started at /in/XDqLS:7) in /in/XDqLS on line 9 array(0) { }
Output for 7.2.29 - 7.2.33, 7.3.16 - 7.3.31, 7.4.3 - 7.4.25
Warning: DOMDocument::loadHTMLFile(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/XDqLS on line 7 Warning: DOMDocument::loadHTMLFile(http://beta.congress.gov/search?pageSort=dateOfIntroduction%253Adesc&q=%7B%2522congress%2522%253A%2522112%7C113%7C111%7C110%7C109%7C108%7C107%7C106%2522%252C%2522source%2522%253A%2522legislation%2522%7D&pageSize=25): failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/XDqLS on line 7 Warning: Cannot modify header information - headers already sent by (output started at /in/XDqLS:7) in /in/XDqLS on line 9 array(0) { }

preferences:
177.07 ms | 403 KiB | 319 Q