3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $input = "What do you carry in your purse/wallet?"; $numbertoscan = 5; $query = str_replace(' ', '%20', $input); $i=0; while($i<$numbertoscan){ $url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=".$query."&start=".$i*4; $body = file_get_contents($url); $json = json_decode($body); for($x=0;$x<count($json->responseData->results);$x++){ //echo "<b>Result ".($x+1)."</b>"; //echo "<br>URL: "; // $json->responseData->results[$x]->url; //echo "<br>VisibleURL: "; //echo $json->responseData->results[$x]->visibleUrl; //echo "<br>Title: "; //echo $json->responseData->results[$x]->title; //echo "<br>Content: "; if (strpos($json->responseData->results[$x]->content,' i ') !== false) { echo $json->responseData->results[$x]->content; echo "<br><br>"; } } $i++; } ?>
Output for 7.2.0
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=What%20do%20you%20carry%20in%20your%20purse/wallet?&start=0): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Notice: Trying to get property 'responseData' of non-object in /in/0BGsi on line 11 Notice: Trying to get property 'results' of non-object in /in/0BGsi on line 11 Warning: count(): Parameter must be an array or an object that implements Countable in /in/0BGsi on line 11 Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=What%20do%20you%20carry%20in%20your%20purse/wallet?&start=4): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Notice: Trying to get property 'responseData' of non-object in /in/0BGsi on line 11 Notice: Trying to get property 'results' of non-object in /in/0BGsi on line 11 Warning: count(): Parameter must be an array or an object that implements Countable in /in/0BGsi on line 11 Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=What%20do%20you%20carry%20in%20your%20purse/wallet?&start=8): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Notice: Trying to get property 'responseData' of non-object in /in/0BGsi on line 11 Notice: Trying to get property 'results' of non-object in /in/0BGsi on line 11 Warning: count(): Parameter must be an array or an object that implements Countable in /in/0BGsi on line 11 Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=What%20do%20you%20carry%20in%20your%20purse/wallet?&start=12): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Notice: Trying to get property 'responseData' of non-object in /in/0BGsi on line 11 Notice: Trying to get property 'results' of non-object in /in/0BGsi on line 11 Warning: count(): Parameter must be an array or an object that implements Countable in /in/0BGsi on line 11 Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=What%20do%20you%20carry%20in%20your%20purse/wallet?&start=16): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Notice: Trying to get property 'responseData' of non-object in /in/0BGsi on line 11 Notice: Trying to get property 'results' of non-object in /in/0BGsi on line 11 Warning: count(): Parameter must be an array or an object that implements Countable in /in/0BGsi on line 11
Output for 5.3.18 - 5.4.45, 5.5.33, 5.6.18 - 5.6.19, 7.0.4, 7.0.20, 7.1.5 - 7.1.10
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=What%20do%20you%20carry%20in%20your%20purse/wallet?&start=0): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Notice: Trying to get property of non-object in /in/0BGsi on line 11 Notice: Trying to get property of non-object in /in/0BGsi on line 11 Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=What%20do%20you%20carry%20in%20your%20purse/wallet?&start=4): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Notice: Trying to get property of non-object in /in/0BGsi on line 11 Notice: Trying to get property of non-object in /in/0BGsi on line 11 Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=What%20do%20you%20carry%20in%20your%20purse/wallet?&start=8): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Notice: Trying to get property of non-object in /in/0BGsi on line 11 Notice: Trying to get property of non-object in /in/0BGsi on line 11 Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=What%20do%20you%20carry%20in%20your%20purse/wallet?&start=12): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Notice: Trying to get property of non-object in /in/0BGsi on line 11 Notice: Trying to get property of non-object in /in/0BGsi on line 11 Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=What%20do%20you%20carry%20in%20your%20purse/wallet?&start=16): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/0BGsi on line 9 Notice: Trying to get property of non-object in /in/0BGsi on line 11 Notice: Trying to get property of non-object in /in/0BGsi on line 11
Output for 5.5.24 - 5.5.32, 5.5.34 - 5.6.17, 5.6.20 - 7.0.3, 7.0.5 - 7.0.6, 7.1.0
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/0BGsi on line 9 Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=What%20do%20you%20carry%20in%20your%20purse/wallet?&start=0): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/0BGsi on line 9 Notice: Trying to get property of non-object in /in/0BGsi on line 11 Notice: Trying to get property of non-object in /in/0BGsi on line 11 Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/0BGsi on line 9 Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=What%20do%20you%20carry%20in%20your%20purse/wallet?&start=4): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/0BGsi on line 9 Notice: Trying to get property of non-object in /in/0BGsi on line 11 Notice: Trying to get property of non-object in /in/0BGsi on line 11 Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/0BGsi on line 9 Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=What%20do%20you%20carry%20in%20your%20purse/wallet?&start=8): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/0BGsi on line 9 Notice: Trying to get property of non-object in /in/0BGsi on line 11 Notice: Trying to get property of non-object in /in/0BGsi on line 11 Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/0BGsi on line 9 Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=What%20do%20you%20carry%20in%20your%20purse/wallet?&start=12): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/0BGsi on line 9 Notice: Trying to get property of non-object in /in/0BGsi on line 11 Notice: Trying to get property of non-object in /in/0BGsi on line 11 Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/0BGsi on line 9 Warning: file_get_contents(http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=What%20do%20you%20carry%20in%20your%20purse/wallet?&start=16): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/0BGsi on line 9 Notice: Trying to get property of non-object in /in/0BGsi on line 11 Notice: Trying to get property of non-object in /in/0BGsi on line 11