Skip to content

akifquddus/Wordpress-REST-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Wordpress-REST-API

Simplified and Secure REST API to Create a Wordpress Post with Featured Image

Verify User Wordpress URL and Login Info

$fields_string = "";
$fields = array(
  'wprequest' => true,
  'user' => 'admin',
  'pass' => 'password',
  'type' => 'verify',
);

foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');

$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_URL, 'http://example.com' . $this->path);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);

$result = json_decode(curl_exec($ch));

Result

{
  "status" => true,
  "message" => "Account Successfully Verified"
}

About

Wordpress API to Create Post

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages