How to send a request to the WooCommerce API

I’m currently building a solution for a company as an intern, and I need to use the WooCommerce REST API features in my C++ project to send data to the website.

I’ve so far, after 2 long painful days, managed to install the cURL library (through vcpkg) and tested the library a bit with the many examples that you can find on the internet. But for now, what I found doesn’t seem to match with what the people at WooCommerce put in their documentation. For example, in this section, they show how to create a product on the platform using cURL, but I can’t understand how to translate it in cURL language inside the C++ project. Heck, the command doesn’t even work when I use it in the command prompt with my parameters.

#include <curl/curl.h> #include <string>  // cUrl declaration      CURL* curl;     CURLcode res;     std::string readBuffer;     std::string URL = "";      curl_global_init(CURL_GLOBAL_ALL);     curl = curl_easy_init();     if (curl) {         curl_easy_setopt(curl, CURLOPT_URL, URL);         curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);         curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);         res = curl_easy_perform(curl);          // Check for errors         if (res != CURLE_OK) {             std::string error = "curl_easy_perform() failed: ";             error += curl_easy_strerror(res);             error += "\nImpossible de se connecter au site WooCommerce fourni. Veuillez verifier vos paramètres et redémarrer l'application.";             wxMessageBox(error);         }         else {             std::string success = "Connexion au domaine ";             success += URL;             success += " réussie.\nPour changer de domaine, veuillez consulter la page Paramètres.";             wxMessageBox(success);         }      }      // cleanup     curl_easy_cleanup(curl);     curl_global_cleanup(); 

This code works fine, I know that I have to add the company’s website instead of the example, but I can’t figure out where to add my client key and client secret (basically like in the example shown on the WooCommerce doc). The basic cURL commands work fine in my local command prompt, but the example doesn’t event work. I know that my request for help may be kind of basic and easy to solve but I just spent the last 2 days and a half working on this and I’m starting to lose it.

Thanks for your help, I tried to speak the best english I could, so sorry in advance for any typo, or sorry if my post doesn’t live up to the presentation standards of this platform, I’m kinda new around here 😀

Git, TFS Pull Request Workflow

Here is the workflow I’ve been attempting, after watching a this Git/TFS video.

So I create a branch from my development branch

$   git checkout -b my-feature-branch development 

Then I make a change, stage, commit, and push the changes up to the TFS server.

Now when I go to the TFS web interface, I have a “my-feature-branch” on the server.

I click “New Pull Request” and create a PR into development, and Accept this PR. This process deletes the “my-feature-branch” on the TFS server, but it remains on my local machine.

Everything is great at this point.

Back to my local machine, switch out of the feature branch:

git checkout development 

Delete the local branch

  git branch -d my-feature-branch  warning: deleting branch 'my-feature-branch' that has been merged to          'refs/remotes/origin/test-pr', but not yet merged to HEAD. Deleted branch my-feature-branch (was d525adc). 

Get latest –

git pull -p 

Sometimes, and I may be doing the pull prior to the delete, the delete Fails and I have to Force Delete it.

git branch -D my-feature-branch 

Is my workflow wrong? Should I be doing some kind of merge prior to deletion? Why doesn’t git know the feature branch has been merged in as a Pull Request after the pull and let me delete without error?

301 redirect request

Hi there, I want to redirect an old domain to a new domains directory. Example of what I mean ---- forum was installed in this dirctory --- this is where it needs to redirect.
Code (markup):

TROUBLESHOOT REQUEST – Snow Leopard over VirtualBox on Windows 32 bit – BOOTLOG

Bootlog SnowLeopard on VirtualBox for Windows

Hello, someone can help me with this? I followed the instructions but I have to handle with an error (!!) during installation. Here is the bootlog in VirtualBox. I cannot even low level erase the disk, just erase, and then after customizing the installation it freezes when computing installation time. After almost ten minutes it quits givin an impossible to install files on /nameofpartition/. If needed I will post the snapshot.

Thank you!


Script for searching personal data in HTTPS request from Android [on hold]

How can I search for personal data in Burp Suite HTTP/HTTPS requests? I using Burp Suite for pen testing Android apps and I need some script for searching personal data which are transmited from Android Emulator to the server.

For example like in this thesis. They are using some Python script and searching personal data based on keywords.

parse src link from iframe response received from a post request

Im making a post request with data in python like this

select_req ='', data=data) print(select_req.text) 

this outputs

<iframe class="paymentFrame" src="" width="100%" height="400"  scrolling="yes" frameborder="no"></iframe> 

I want to parse the src link and save it to parsed_link


I want this to output

How to fix parsing errors in POST request in Rust Rocket framework

I am making a very simple web app using the rust Rocket framework. I have a very simple HTML file that has a form, as follows:

<form action="/search" method="post" accept-charset="utf-8">   Search Term:<input type="text" name="searchterm">   <input type="submit" value="search"> </form> 

Next, here are my rocket functions to deal with the requests. I have a get function that spits out index.html when accessing “/”, then for my form, I have the following functions:

#[derive(FromForm)] pub struct Request<'r> {   payload: &'r RawStr,   //we can add more if we want later on, for other form options... }  #[post("/search", data = "<data>")] pub fn process(data: Form<Request>) -> Result<Redirect, String> {   if data.payload == "Hello!" {     Ok(Redirect::to("/search/Hello"))   } else {     Err(format!("Unknown search term, '{}'.", data.payload))   } } 

Then, this is to respong to the GET requests:

#[get("/search/<term>")] pub fn response(term: &RawStr) -> String {   format!("You typed in {}.", term) } 

Like I said, very simple, very barebones, just trying to tiptoe into both Rust and Web Apps at the same time. I do not have much experience in either. My issue is, when using the field presented to the user in my html file, the server returns an error:

POST /search application/x-www-form-urlencoded: => Matched: POST /search (process) => Error: The incoming form failed to parse. => Outcome: Failure => Warning: Responding with 422 Unprocessable Entity catcher. => Response succeeded. 

If I go directly, to “localhost:8000/search/Hello!” I can see that my GET response works. But if I use my form it refuses to parse. What am I doing wrong? I am simply attempting to make a web app that takes an input, and based on that input, returns something. Website redirection, web scraping, I am not sure on the specifics of functionality yet, but I need to be able to type something into the form and obtain it for use in my rust code later. Any help would be appreciated!