3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sql = "select * from subscribe where type ='$cat' and city ='$city'"; $query = mysql_query($sql); if ($query != null) { while ($row = mysql_fetch_array($query)) { //$name = $row['name']; $phoneNum = $row['fone']; $message = "Hi Now you can buy your product."; ozekiSend($phoneNum, $message); // for debugging, try the following line //echo ozekiSend($phoneNum, $message, true); } } ######################################################## # Login information for the SMS Gateway ######################################################## $ozeki_user = "admin"; $ozeki_password = "abc123"; $ozeki_url = "http://127.0.0.1:9501/api?"; ######################################################## # Functions used to send the SMS message ######################################################## function httpRequest($url) { $pattern = "/http...([0-9a-zA-Z-.]*).([0-9]*).(.*)/"; preg_match($pattern, $url, $args); $in = ""; $fp = fsockopen("$args[1]", $args[2], $errno, $errstr, 30); if (!$fp) { return("$errstr ($errno)"); } else { $out = "GET /$args[3] HTTP/1.1\r\n"; $out .= "Host: $args[1]:$args[2]\r\n"; $out .= "User-agent: Ozeki PHP client\r\n"; $out .= "Accept: */*\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); while (!feof($fp)) { $in.=fgets($fp, 128); } } fclose($fp); return($in); } function ozekiSend($phone, $msg, $debug = false) { global $ozeki_user, $ozeki_password, $ozeki_url; $url = 'username=' . $ozeki_user; $url.= '&password=' . $ozeki_password; $url.= '&action=sendmessage'; $url.= '&messagetype=SMS:TEXT'; $url.= '&recipient=' . urlencode($phone); $url.= '&messagedata=' . urlencode($msg); $urltouse = $ozeki_url . $url; if ($debug === true) { echo "Request: <br>$urltouse<br><br>"; } //Open the URL to send the message $response = httpRequest($urltouse); if ($debug === true) { echo "Response: <br><pre>" . str_replace(array("<", ">"), array("&lt;", "&gt;"), $response) . "</pre><br>"; } return($response); } ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Warning: Undefined variable $cat in /in/BeIQ9 on line 2 Warning: Undefined variable $city in /in/BeIQ9 on line 2 Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/BeIQ9:3 Stack trace: #0 {main} thrown in /in/BeIQ9 on line 3
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined variable: cat in /in/BeIQ9 on line 2 Notice: Undefined variable: city in /in/BeIQ9 on line 2 Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/BeIQ9:3 Stack trace: #0 {main} thrown in /in/BeIQ9 on line 3
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/BeIQ9:3 Stack trace: #0 {main} thrown in /in/BeIQ9 on line 3
Process exited with code 255.
Output for 5.0.4 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
Notice: Undefined variable: cat in /in/BeIQ9 on line 2 Notice: Undefined variable: city in /in/BeIQ9 on line 2 Fatal error: Call to undefined function mysql_query() in /in/BeIQ9 on line 3
Process exited with code 255.
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: cat in /in/BeIQ9 on line 2 Notice: Undefined variable: city in /in/BeIQ9 on line 2 Fatal error: Call to undefined function mysql_query() in /in/BeIQ9 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Notice: Undefined variable: cat in /in/BeIQ9 on line 2 Notice: Undefined variable: city in /in/BeIQ9 on line 2 Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/BeIQ9 on line 3 Warning: mysql_query(): A link to the server could not be established in /in/BeIQ9 on line 3
Output for 4.3.0 - 4.3.1
Notice: Undefined variable: cat in /in/BeIQ9 on line 2 Notice: Undefined variable: city in /in/BeIQ9 on line 2 Warning: mysql_query() [http://www.php.net/function.mysql-query]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/BeIQ9 on line 3 Warning: mysql_query() [http://www.php.net/function.mysql-query]: A link to the server could not be established in /in/BeIQ9 on line 3

preferences:
264.46 ms | 402 KiB | 426 Q