FINALLY! i have found the solution to my problem
when running the built-in php server . We need to specify this command
php bin/console server:run 0.0.0.0:8000
(8000 is my port , you can put yours)
so that Any device or host (ip) could access
if you put
127.0.0.1 only your localhost will be allowed
That's why i couldn't get the Api even i was connected to my localhost via wifi hotspot
It's ok now
Are you able to install this cURL App for Android?
Then use on your Android (is this a real phone or an emulator) open a cURL window and then enter:
I tried this same kind of setup with a real Android phone and the above indicated cURL app and put in my Symfony web URL (on another PC), and the Android shows the correct html response back that I'm expecting.
At least this will help you verify functionality first.
Edit below this line:
Here is the code you might use since HttpClient was deprecated:
URL url = new URL("http://192.168.43.13:8000/api/horaire.json"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); //conn.setRequestMethod("GET"); // read the response System.out.println("Response Code: " + conn.getResponseCode()); InputStream in = new BufferedInputStream(conn.getInputStream()); String response = org.apache.commons.io.IOUtils.toString(in, "UTF-8"); System.out.println(response);
Not sure if you need to use the "setRequestMethod". But try out this change and see if that works for you.
- Connection Refused for Android Device Web Service SYMFONY 3
- Symfony 6 - Connection refused for localhost
- Symfony 4 - no such service exists for ObjectManager after composer update
- Symfony 2 SQLSTATE[HY000]  Connection refused Error
- Symfony 3.3 service mocks for functional tests
- SQLSTATE[HY000]  Connection refused - MAMP & Symfony 2
- Gitlab CI Symfony : SQLSTATE[HY000]  Connection refused
- Symfony Circular Reference Exception for Doctrine onFlush Event Listener Service
- SQLSTATE: [Microsoft][ODBC Driver 13 for SQL Server]TCP Provider: No connection could be made because the target machine actively refused it
- Symfony 4.2 How to do a service public only for tests
- How to register the DBAL Doctrine connection as a service without the DoctrineBundle in Symfony 4
- How to test for static files located in the web folder in symfony with phpunit?
- Symfony SQLSTATE[HY000]  Connection refused with 1and1 server
- I installed symfony 3, ran the server and got a connection refused when I ran the webserver
- Symfony 3.4 - Circular reference detected for service
- Database connection refused with Symfony / PHP
- soap web service with symfony
- Where to put config file for my own library and have the path injected into Symfony service
- Troubles with firewall symfony 6. Error: Class "" used for service "security.listener.user_checker.integration" cannot be found
- Replace a private service in the Symfony container for testing
- Symfony + Docker, connection refused
- Symfony 5 + Docker: SQLSTATE[HY000]  Connection refused
- Symfony dependency injection or service location for Repositories in PHPUnit tests
- Symfony 3.4 and Doctrine: How can I get the connections defined in config.yml from inside a service using the name of the connection
- How to correct provide web pack for my symfony project in docker?
- An exception occured in driver: SQLSTATE[HY000]  Connection refused Trying to create a database on symfony 3.4
- Symfony 5 Cannot autowire argument $Driver for a dynamic database connection
- Could not drop database `symfony-project` for connection named default An exception occurred in driver: SQLSTATE[HY000]  Connection refused
- Symfony 2: [PDOException] SQLSTATE[HY000]  Connection refused entity generator
- How to access a Symfony service that is used by a client request in a web test case?
More Query from same tag
- Symfony2 FOSUserBundle FlashBag
- Symfony2 OneToMany Relation - get object via hidden form field?
- relations between controllers in Symfony2
- doctrine:migrations:diff generates 2 tables instead of one for ManyToMany relation
- Login form action issue in symfony2 traditional login form
- Relations with TWIG
- Get path in entity with Sonata and Symfony 3
- Two symfony projects on one server/domain
- Sonataadminbundle: Multiple admin section for same entity
- Symfony3 entity property not being updated through OneToMany association method
- Dynamic timestamp for assetic?
- TCPDF & mPDF error: Some data has already been output to browser, can't send PDF file
- How to create my own function in the Entity in Symfony 2
- How to use CSRF token in Silex 2 via Twig template?
- Set up symfony4 URI with ONLY .htaccess
- Where to put code which should run and set up some variables for every route?
- Sylius TOPIC: Is it possible to make ORM Relationship between 'ContentBundle\Doctrine\Phpcr\StaticContent' and 'sylius\component\core\model\Produit'
- Generate new CSRF token without reloading the entire form
- Find a specific object inside the array of objects from a ReferenceMany field
- symfony2 - the assetic assetic:dump command doesn't create stylesheets correctly
- Easyadmin is not recognizing boolean type
- Symfony2 translation issue
- How to redirect without GET parameters using the routing?
- Symfony2 access control not working
- Twig : Get value of the entity attached to the form in twig view Symfony
- Symfony 2 / Doctrine 2, ORDER BY with BIT_AND operator
- How to create query for selecting many to many elements
- Shortcuts with Symfony2 Twig forms : form_widget
- PHP Symfony2 add 60 years to the both day Datetime object of a person
- How to display layout content in Twig template based on a view