Salta al contenuto
  • CATEGORIES
  • La Community Connect.gt
  • Presentati alla Community
  • News Ufficiali da Connect.gt
  • Internet News
  • A Scuola Di
  • Digital Marketing
  • Intelligenza Artificiale
  • SEO & GEO
  • Web Marketing e Content
  • Google Analytics e Web Analytics
  • Google Ads & Advertising
  • YouTube
  • TikTok, Instagram e altri Social
  • Google Adsense, Affiliazioni e Guadagno
  • E-Commerce
  • Coding e Sistemistica
  • Help Center: consigli per il tuo progetto
  • Hosting e Cloud
  • Coding
  • CMS & Piattaforme Self-Hosted
  • Annunci e Collaborazioni
  • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
  • Collaborazioni WEB e Lavoro: offro e cerco
  • Impresa, Fisco e Leggi
  • Consulenza Legale e Professioni Web
  • Consulenza Fiscale, Imprese, Startup e P.Iva
  • Gli Off Topic
  • PC, Smartphone e altri Hardware
  • Tutti i Software
  • GT Fetish Cafè
  • Discussioni
  • 0 Non letti 0
  • Recenti
  • Hashtag
  • Popolare
  • Utenti
  • Privacy
  • Termini e condizioni
  • © 2026 Search On Media Group S.r.l.
Collassa
Connect.gt
Il network Search On
Connect.gt WMF AI Festival Accademia Advanced SEO Tool AgentCy Social Media Strategies Search Tech
Registrati Accedi
Connect.gt
Stream Interest Categorie Hashtag
  1. La community italiana di SEO, marketing digitale e AI
  2. Categorie
  3. Coding e Sistemistica
  4. Coding
  5. [JAVA] Come chiamo una apgina php da Java???

[JAVA] Come chiamo una apgina php da Java???

Pianificato Fissato Bloccato Spostato Coding
2 Post 2 Autori 912 Visualizzazioni 1 Seguito
  • Da Vecchi a Nuovi
  • Da Nuovi a Vecchi
  • Più Voti
Rispondi
  • Risposta alla discussione
Effettua l'accesso per rispondere
Questa discussione è stata eliminata. Solo gli utenti con diritti di gestione possono vederla.
  • D
    D
    digital.daigor
    scritto su ultima modifica di
    User Attivo 5
    #1
    [JAVA] Come chiamo una apgina php da Java???

    We......
    ho un idea da mettere in pratica....premetto che di JAVA capisco poco, quindi se rispondete siate moooolto chiari....

    Come posso chiamare una pagina PHP da JAVA?????

    1 Risposta Ultima Risposta
    Miglior risposta 0
    0
    • C
      C
      cali1981
      scritto su ultima modifica di
      Super User 20
      #2

      Chiamare intendi cioè scaricare il contenuto? Se è questo, prova questo script preso in rete:

      // This example is from _Java Examples in a Nutshell_. (http://www.oreilly.com)
      // Copyright (c) 1997 by David Flanagan
      // This example is provided WITHOUT ANY WARRANTY either expressed or implied.
      // You may study, use, modify, and distribute it for non-commercial purposes.
      // For any commercial use, see http://www.davidflanagan.com/javaexamples
      
      import java.io.*;
      import java.net.*;
      
      /**
       * This program connects to a Web server and downloads the specified URL
       * from it.  It uses the HTTP protocol directly.
       **/
      public class HttpClient {
        public static void main(String[] args) {
          try {
            // Check the arguments
            if ((args.length != 1) && (args.length != 2))
              throw new IllegalArgumentException("Wrong number of arguments");
            
            // Get an output stream to write the URL contents to
            OutputStream to_file;
            if (args.length == 2) to_file = new FileOutputStream(args[1]);
            else to_file = System.out;
            
            // Now use the URL class to parse the user-specified URL into
            // its various parts: protocol, host, port, filename.  Check the protocol
            URL url = new URL(args[0]);
            String protocol = url.getProtocol();
            if (!protocol.equals("http"))
              throw new IllegalArgumentException("URL must use 'http:' protocol");
            String host = url.getHost();
            int port = url.getPort();
            if (port == -1) port = 80;  // if no port, use the default HTTP port
            String filename = url.getFile();
            // Open a network socket connection to the specified host and port
            Socket socket = new Socket(host, port);
            // Get input and output streams for the socket
            InputStream from_server = socket.getInputStream();
            PrintWriter to_server = 
              new PrintWriter(new OutputStreamWriter(socket.getOutputStream()));
            
            // Send the HTTP GET command to the Web server, specifying the file.
            // This uses an old and very simple version of the HTTP protocol
            to_server.println("GET " + filename);
            to_server.flush();  // Send it right now!
            
            // Now read the server's response, and write it to the file
            byte[] buffer = new byte[4096];
            int bytes_read;
            while((bytes_read = from_server.read(buffer)) != -1)
              to_file.write(buffer, 0, bytes_read);
            
            // When the server closes the connection, we close our stuff
            socket.close();
            to_file.close();
          }
          catch (Exception e) {    // Report any errors that arise
            System.err.println(e);
            System.err.println("Usage: java HttpClient <URL> [<filename>]");
          }
        }
      }
      
      1 Risposta Ultima Risposta
      Miglior risposta 0
      0

      Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.

      Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.

      Con il tuo contributo, questo post potrebbe essere ancora migliore 💗

      Registrati Accedi
      Rispondi
      • Risposta alla discussione
      Effettua l'accesso per rispondere
      • Da Vecchi a Nuovi
      • Da Nuovi a Vecchi
      • Più Voti


      • Accedi

      • Non hai un account? Registrati

      • Accedi o registrati per effettuare la ricerca.
      • Primo post
        Ultimo post
      Home Accedi Registrati
      Menu
      • CATEGORIES
      • La Community Connect.gt
      • Presentati alla Community
      • News Ufficiali da Connect.gt
      • Internet News
      • A Scuola Di
      • Digital Marketing
      • Intelligenza Artificiale
      • SEO & GEO
      • Web Marketing e Content
      • Google Analytics e Web Analytics
      • Google Ads & Advertising
      • YouTube
      • TikTok, Instagram e altri Social
      • Google Adsense, Affiliazioni e Guadagno
      • E-Commerce
      • Coding e Sistemistica
      • Help Center: consigli per il tuo progetto
      • Hosting e Cloud
      • Coding
      • CMS & Piattaforme Self-Hosted
      • Annunci e Collaborazioni
      • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
      • Collaborazioni WEB e Lavoro: offro e cerco
      • Impresa, Fisco e Leggi
      • Consulenza Legale e Professioni Web
      • Consulenza Fiscale, Imprese, Startup e P.Iva
      • Gli Off Topic
      • PC, Smartphone e altri Hardware
      • Tutti i Software
      • GT Fetish Cafè
      • Discussioni
      • Non letti 0
      • Recenti
      • Hashtag
      • Popolare
      • Utenti
      • Privacy
      • Termini e condizioni
      • © 2026 Search On Media Group S.r.l.