Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

i am trying to get data from my local database to android device but i on every try i got "java.net.ConnectException: /127.0.0.1:443 - Connection refused" message

String url = "https://127.0.0.1/www/json.php?userId=admin&type=1234"; 

this is my link i am using and these are my php codes

<?php 

 $mysql_host = "localhost"; 
 $mysql_user = "admin"; 
 $mysql_password = "1234";  
 $mysql_dbname ="json";  

 $conn = @mysql_connect($mysql_host, $mysql_user, $mysql_password);
 if(! $conn) die("MySQL Error: ".mysql_error());

 mysql_select_db($mysql_dbname, $conn) or die("MySQL Error: ".mysql_error());

?>

<?php

include("connect.php");

$arg1 = $_GET['userId'];
$arg2 = $_GET['type'];

mysql_query("SET NAMES 'utf8'");
$query = mysql_query("select * from product");
$rows = array();
while($r = mysql_fetch_assoc($query)) {
    $rows[] = $r;
}

$json = array();
$json['userId'] = $arg1;
$json['type'] = $arg2;
$json['products'] = $rows;

die(json_encode($json)); 

?>

and my php files are in C:\xampp\htdocs\www directory

share|improve this question
are you sure you can correctly connect to the mysql database? the problem seems to be there rather than in the code itself. – Saturnix Apr 26 at 0:15
yeah i can connect database – Ndr Krty Apr 26 at 0:16
"java.net.ConnectException: /127.0.0.1:443 - Connection refused" means that the problem is not in your code. Have you tried opening your url with a normal browser? What do you see? Try opening: 127.0.0.1:443/www/json.php?userId=admin&type=1234 – Saturnix Apr 26 at 0:19
port 443 is used for HTTPS, have you tried using normal HTTP? – Saturnix Apr 26 at 0:22
when i click your link which gives warning but when i proceed to continue i can reach the database – Ndr Krty Apr 26 at 0:23
show 5 more comments

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.