Thanks for reading.
I'm trying to submit a post via PHP. I'm filling in a large number of posts from a good amount of data I've scraped so I need this to be automated. I don't have the time (or desire) to manually input 700+ posts.
I am versatile with programming, but newer to WordPress (I've been saying that for almost a year but I still feel like it's true).
My cURL function is working great, I receive no errors and data back from curl_getinfo that is indicating it's working.
I dug into the Chrome Developer tools and did two things: I looked at the form before it's sent and saw the action of the form:
http://domain.com/wp-admin/edit-tags.php
And then I submitted a test form to see which $_REQUEST variables were going through and I filled them in respectively.
$url = 'http://domain.com/wp-admin/edit-tags.php';
//$url = 'http://domain.com/wp-admin/admin-ajax.php';
$fields = array(
"action" => "add-tag",
"screen" => "edit-property_city",
"taxonomy" => "property_city",
"post_type" => "estate_property",
"_wpnonce_add-tag" => "483c44d6e2",
"_wp_http_referer" => "/wp-admin/edit-tags.php?taxonomy=property_city&post_type=estate_property",
"tag-name" => $city,
"slug" => $slug,
"parent" => "-1",
"description" => "description",
"term_meta[pagetax]" => "page_id",
"term_meta[category_featured_image]" => "",
"term_meta[category_attach_id]" => "",
"term_meta[category_tagline]" => "tag",
"term_meta[category_tax]" => "property_city"
You'll notice I havea second url/action. That's because when the form completes, the url in the chrome dev tools is admin-ajax.php. I figured that theres a redirect that I'm missing. I used my debugger in the backend to debug the action when I went throug the form but I got no where. The reason I don't use WordPress more often is because it's a nightmare on the backend with all the hooks and function slugs.
If anyone has any suggestions as to what I can do to automate custom posts, or if WordPress has a recommended way to automate posts, I'd genuinely appreciate any information. :)
I have also read about nonces and I'm under the impression they last for 24 hrs. I've checked a few times and they are valid.
EDIT
Thanks to the responses on my post. Although it didn't help me successful post a Post via cURL, the WP-API was very helpful. I went into my database and looked at the content of my wp_posts and the foreign key relations to its wp_postmeta records. And from there realized what was needed to insert a succesful post.