Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor inthylight

    (@inthylight)

    @stephentyers

    Does your script connect/authenticate via the WP API? If so, on the Clef settings page, try enabling the Allow passwords for API option and then running the script. I think that should do the trick.

    Thread Starter stephentyers

    (@stephentyers-1)

    Hi,

    That didn’t work unfortunately, i’ve pasted my php script below it basically uses curl to call a url that updates my prices. I’ve starred at my username and password. Can you let me know if it’s possible to integrate this with Clef?

    Many thanks again
    Steve

    <?php

    $username=’testaccount’;
    $password=’testpassword’;
    $url=’https://www.thegoldregister.co.uk/&#8217;;

    $postdata = ‘log=’. $username .’&pwd=’. $password .’&wp-submit=Log%20In&redirect_to=’. $url .’wp-admin/&testcookie=1′;
    $ch = curl_init();
    curl_setopt ($ch, CURLOPT_URL, $url . ‘wp-login.php’);
    curl_setopt ($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_COOKIESESSION, true);
    curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
    //curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    //curl_setopt($ch, CURLOPT_CAINFO, getcwd() . “public_html/wp-content/plugins/goldregister/BuiltinObjectToken:GoDaddyClass2CA.crt”);
    curl_setopt ($ch, CURLOPT_USERAGENT, ‘Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6’);
    curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
    curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt ($ch, CURLOPT_REFERER, $url . ‘wp-admin/’);
    curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
    curl_setopt ($ch, CURLOPT_POST, 1);
    $result = curl_exec ($ch);

    $end = strpos($result, ‘Content-Type’);
    $start = strpos($result, ‘Set-Cookie’);
    $parts = split(‘Set-Cookie: ‘,substr($result, $start, $end-$start));
    $cookies = array();
    foreach ($parts as $co) {
    $cd = split(‘;’,$co);
    if (!empty($cd[0]))
    $cookies[] = $cd[0];
    }

    curl_setopt ($ch, CURLOPT_URL, $url . ‘wp-admin/admin.php?page=Gold_Register_Import’);
    curl_setopt ($ch, CURLOPT_COOKIE, implode(‘;’,$cookies));
    curl_setopt ($ch, CURLOPT_HEADER, 0);
    $result = curl_exec ($ch);

    echo $result;

    ?>

    Plugin Contributor inthylight

    (@inthylight)

    @stephentyers

    Can you send me an email via [email protected]? I’d like to follow up with you on this by email. . . .

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Running Cron Job with clef’ is closed to new replies.