Jump to content

winhttp instead of _IE functions for wordpress ?


Recommended Posts

hello everybody 

due to facing so many errors with _IE functions I found winhttp udf can do the same but I have a bit info about. 

to create a post in my wordpress I use this code 

#include <WinHttp.au3>

$sLoginPage = '/wp-login.php'
$postPage = '/wp-admin/post-new.php'


$sDomain = 'https://mhd2020.000webhostapp.com'
$sLogin = '**********'
$sPassword = '*********'

ConsoleWrite("Connecting..."&@CRLF)
$hOpen = _WinHttpOpen()
$hConnect = _WinHttpConnect($hOpen, $sDomain)

ConsoleWrite("Signing in... "&@CRLF)
; Login first
_WinHttpSimpleFormFill($hConnect, _
        $sLoginPage, _
        "loginform", _
        'user_login', $sLogin, _
        'user_pass', $sPassword)

ConsoleWrite('! Error for login = ' & @error & @LF)

ConsoleWrite("creating a post."&@CRLF)

$sResponse = _WinHttpSimpleFormFill($hConnect, _
        $postPage, _
        "post", _
        'title', "Test" ,'content', "test test test")

ConsoleWrite('! Error for create = ' & @error & @LF)


_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)

it could create a post but without publishing (just a draft)

I need to:

- checkbox in category field by object ID e.g: "in-category-1"

- submit a post (not make a draft post)

 how to do this please ?

Edited by AlienStar
Link to comment
Share on other sites

mm i suppose you wanna  create  a Macro , for work with your site , for my best opinion is much  stable if  you use  a REST API in wordpress , or  work directly with database of  site ,if  you want  create macro in site  full of javascript  , is much better if  you use  , webdriver  , but is only my opinion good luck

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...