WordPress.org

Ready to get started?Download WordPress

Forums

XML RPC doesn't work on localhost (8 posts)

  1. collimarco
    Member
    Posted 6 years ago #

    I am trying to create something like http://rpc.pingomatic.com/ (it's only a test for now).

    I installed WordPress on localhost, and I create a page with the following code:

    <?php
    ob_start();
    var_dump($_POST);
    $content = ob_get_clean();
    
    $handle = fopen("info.txt", "w");
    fwrite($handle, $content);
    fclose($handle);
    ?>

    I added the page to the Update Services in WordPress.

    Then I tried to post an article, but the test page wasn't loaded (I also looked at the Apache log).
    Why WordPress did't post the article to the test page?

    Thanks in advance for the help!

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    The pinging process happens through the use of wp-cron, asynchronously. The generic ping uses fsockopen to connect to the site in question, so you need to make sure that your PHP allows the use of fsockopen.

    Also, did you load your blog page itself afterwards, to allow wp-cron to run properly?

  3. collimarco
    Member
    Posted 6 years ago #

    you need to make sure that your PHP allows the use of fsockopen

    I tried to connect to 127.0.0.1 using fsockopen and it seems to work, while if I use localhost instead of 127.0.0.1 I get the following error:

    Warning: fsockopen() [function.fsockopen]: unable to connect to localhost:80 (Impossibile stabilire la connessione. Risposta non corretta della parte connessa dopo l'intervallo di tempo oppure mancata risposta dall'host collegato. ) in C:\xampp\htdocs\burnnn.com\rpc\test.php on line 2
    Impossibile stabilire la connessione. Risposta non corretta della parte connessa dopo l'intervallo di tempo oppure mancata risposta dall'host collegato. (10060)

    So I properly edited wp-config.php, but anyway the test page wasn't loaded (I also tried to load my blog page itself).

    Is there any method to test the xmlrpc.php directly?
    Any other ideas?

    Thanks for the answer!

  4. collimarco
    Member
    Posted 6 years ago #

    I managed to connect to localhost adding the following URL to the update services:

    http://127.0.0.1/test/rpc

    But the following URL won't work on Windows Vista:

    http://localhost/test/rpc

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Is localhost defined in your hosts file? Can you ping localhost from a command line?

  6. collimarco
    Member
    Posted 6 years ago #

    Can you ping localhost from a command line?

    Yes, I can:

    C:\Users\Marco>ping localhost
    
    Esecuzione di Ping LAPTOP-Marco [::1] da ::1 con 32 byte di dati:
    Risposta da ::1: durata<1ms
    Risposta da ::1: durata<1ms
    Risposta da ::1: durata<1ms
    Risposta da ::1: durata<1ms
    
    Statistiche Ping per ::1:
        Pacchetti: Trasmessi = 4, Ricevuti = 4,
        Persi = 0 (0% persi),
    Tempo approssimativo percorsi andata/ritorno in millisecondi:
        Minimo = 0ms, Massimo =  0ms, Medio =  0ms

    The issue is this: http://bugs.php.net/bug.php?id=44335

  7. collimarco
    Member
    Posted 6 years ago #

    I have another question: when WP notifies the update services, does it call a specific function (e.g. weblogUpdates.ping)? If so, what function is called?

    In general, what kind of data does WP send to each URL listed into the update services?

    I am a bit confused about this topic, but unfortunately I can't find much documentation...

  8. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    It calls the weblogUpdates.extendedPing function with the blog's name, the URL, and the RSS2 feed URL. If that is not available, it tries to call the weblogUpdates.ping function with the blog's name and URL only.

    The basic description of the protocol can be found here:
    http://www.weblogs.com/api.html

Topic Closed

This topic has been closed to new replies.

About this Topic