Hi. Sorry I'm new to PHP I am testing out a script to send a message to my Nabaztag but i keep getting the following error Warning: file(http://www.nabaztag.com/vl/FR/api.jsp?sn=0013D380F8FA&token=1207718018&tts=df) [function.file]: failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found in /home/content/d/a/n/danieljcooper/html/testing/index.php on line 114 The script is located at http://www.danieljcooper.co.uk/testing <?php //Set default values if ($sn == "") {$sn = "0013D380F8FA";} if ($tkn == "") {$tkn = "1207718018";} //If no positions found set some value if ($l_ear == "") { $l_ear = "No value set"; $r_ear = "No value set"; $speak = "No value set"; } //Display current status echo " <h3>Nabaztag Ear Mover</h3> This application allows you to control the movement of the ears of your Nabaztag.<br> By default the values of my personal Nabaztag are set, that means you will be moving my Nabaztags ears...<br> For more information about Nabaztag, please consult <a href=http://www.nabazatag.com target=_blank>http://www.nabazatag.com</a> <p> (c) By Ebo Eppenga, email: <a href=mailto:ebo@eppenga>ebo@eppenga.com</a>, website: <a href=http://www.eppenga.com>www.eppenga.com</a> <p> <p><hr><br> <b>Current Status Nabaztag</b> <p> <table cellspacing=0 cellpadding=0> <tr><td>Serial number</td><td>: ".$sn."</td></tr> <tr><td>Token</td><td>: ".$tkn."</td></tr> <tr><td>Left ear</td><td>: ".$l_ear."</td></tr> <tr><td>Right ear</td><td>: ".$r_ear."</td></tr> <tr><td>Pronounced</td><td>: ".$speak."</td></tr> </table> <p> "; //Change current status echo " <b>Change parameters</b> <p> <form action=index.php method=post> <table cellspacing=0 cellpadding=0> <tr><td>Serial number</td><td>: <input type=text name=sn size=12 maxlength=12 value=".$sn."></td></tr> <tr><td>Token</td><td>: <input type=text name=tkn size=15 maxlength=15 value=".$tkn."></td></tr> <tr> <td>Left ear</td> <td>: <select name=l_ear> <option>do nothing</option> <option>0</option><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option> <option>6</option><option>7</option><option>8</option><option>9</option><option>10</option><option>11</option> <option>12</option><option>13</option><option>14</option><option>15</option><option>16</option></select> </td> </tr> <tr> <td>Right ear</td> <td>: <select name=r_ear> <option>do nothing</option> <option>0</option><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option> <option>6</option><option>7</option><option>8</option><option>9</option><option>10</option><option>11</option> <option>12</option><option>13</option><option>14</option><option>15</option><option>16</option></select> </select> </td> </tr> <tr><td>Pronounce</td><td>: <input type=text name=speak size=128 maxlength=128></td></tr> </table> <p> <font color=red><b>Please enter your own token and serial number to control your rabbit.</b></font> <p> <input type=submit value='Set paramaters for Nabaztag'> </form> "; //Retrieve information from form and process $l_ear = $_POST['l_ear']; $r_ear = $_POST['r_ear']; $speak = $_POST['speak']; $cl_ear = ""; $cr_ear = ""; $cspeak = ""; if ($l_ear == "do nothing") {$l_ear = "";} if ($r_ear == "do nothing") {$r_ear = "";} if ($l_ear != "") {$cl_ear = "&posleft=".$l_ear;} if ($r_ear != "") {$cr_ear = "&posright=".$r_ear;} if ($speak != "") { $cspeak = "&tts=".$speak; $cspeak = str_replace(" ","+",$cspeak); } if ($cl_ear != "" or $cr_ear != "" or $cspeak != "") { $eurl = "http://www.nabaztag.com/vl/FR/api.jsp?sn=".$sn."&token=".$tkn.$cl_ear.$cr_ear.$cspeak; $lines = file ($eurl); } ?> PHP: Not really sure whats going wrong. Can anyone help Thanks Daniel J Cooper
It means the url you open is not found. Just try to open it in your browser and you'll get 404 error. You have to replace the url with correct one.
It is a dynamic file. so i think the file function failes to get it into array. First create the file and store it in a unique name, like cddd.php then take the array. thanks