Update wordpress remotely (1 post)

  1. metro
    Posted 3 years ago #

    I wanna update wordpress sites from my cpanel.Actually remotely
    So, i am making a script :

    //login successful
    //upgrading option start
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $urlto);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,"upgrade=Update Now");
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
        curl_setopt($ch, CURLOPT_COOKIEJAR, "COOKIE.txt");
        curl_setopt($ch, CURLOPT_COOKIEFILE, "COOKIE.txt");
    $buffer = curl_exec($ch);

    I can successfully login remotly from my cpanel by run this script. But it is not upgrading the wordpress.
    my wordpress upgrading page html is :

    <form method="post" action="update-core.php?action=do-core-upgrade" name="upgrade" class="upgrade"><input type="hidden" id="_wpnonce" name="_wpnonce" value="5434b20e73" /><input type="hidden" name="_wp_http_referer" value="/testser/wp-admin/update-core.php" /><p><input name="version" value="3.4.2" type="hidden"/><input name="locale" value="en_US" type="hidden"/><input type="submit" name="upgrade" id="upgrade" class="button-primary" value="Update Now" /></form>

    What is the wrong in this code ?

Topic Closed

This topic has been closed to new replies.

About this Topic