F fpdianzen Member Licensed User Longtime User Apr 3, 2013 #1 Hi Good day, im creating a simple application with the use of HTTPJob. my php is good. i have created 2 php scripts that will be used. one is for GET and another for php://input the get is ok. though i can't use it because i find it hard to use with the available resources, because the available one is for php://input. with my php://input script. it returns Forbidden error. please help me why am i encountering such error. :BangHead:
Hi Good day, im creating a simple application with the use of HTTPJob. my php is good. i have created 2 php scripts that will be used. one is for GET and another for php://input the get is ok. though i can't use it because i find it hard to use with the available resources, because the available one is for php://input. with my php://input script. it returns Forbidden error. please help me why am i encountering such error. :BangHead:
Erel B4X founder Staff member Licensed User Longtime User Apr 3, 2013 #2 You can use both GET parameters and php://input together. Can you post your PHP script? Upvote 0
F fpdianzen Member Licensed User Longtime User Apr 3, 2013 #3 B4X: <?php $databasehost = 'XXXXXXXXX'; $databasename = 'XXXXXXX'; $databaseusername = 'XXXXXXXXXXX'; $databasepassword = 'XXXXXXXXXXXX'; $con = mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error()); mysql_select_db($databasename) or die(mysql_error()); $query = file_get_contents('php://input'); if (get_magic_quotes_gpc()) $query = stripslashes($query); $sth = mysql_query($query); if (mysql_errno()) { header('HTTP/1.1 500 Internal Server Error'); echo $query.'\n'; echo mysql_error(); } else { $rows = array(); while($r = mysql_fetch_assoc($sth)) { $rows[] = $r; } print json_encode($rows); } ?> you can try plm.edu.ph/egrades/egradesandroid.php?query=select * from plm_students thanks Upvote 0
B4X: <?php $databasehost = 'XXXXXXXXX'; $databasename = 'XXXXXXX'; $databaseusername = 'XXXXXXXXXXX'; $databasepassword = 'XXXXXXXXXXXX'; $con = mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error()); mysql_select_db($databasename) or die(mysql_error()); $query = file_get_contents('php://input'); if (get_magic_quotes_gpc()) $query = stripslashes($query); $sth = mysql_query($query); if (mysql_errno()) { header('HTTP/1.1 500 Internal Server Error'); echo $query.'\n'; echo mysql_error(); } else { $rows = array(); while($r = mysql_fetch_assoc($sth)) { $rows[] = $r; } print json_encode($rows); } ?> you can try plm.edu.ph/egrades/egradesandroid.php?query=select * from plm_students thanks
Erel B4X founder Staff member Licensed User Longtime User Apr 3, 2013 #4 The Forbidden error is related to your PHP / server configuration. Google for: file_get_contents forbidden Might be related to a missing user agent header. Upvote 0
The Forbidden error is related to your PHP / server configuration. Google for: file_get_contents forbidden Might be related to a missing user agent header.