Custom QR Code with Logo

PAID
By qrcode-monkey | Updated vor 24 Tagen | Tools
Popularity

9.8 / 10

Latency

771ms

Service Level

98%

Health Check

N/A

Back to All Discussions

Sample .NET code for creating QRCodes

Rapid account: Skimad 69
skimad69
vor 6 Jahren

Hi, following on from the code example at: https://market.mashape.com/qrcode-monkey/custom-qr-code-with-logo,
I would like to find some sample .NET code (preferably c#) to enable me to do the following:

Create a QRCode
Save the response and convert to a “png” filename.

When I run the following code, I receive the correct Header responses, but there is no bytes to convert into an image file.

The sample code I’ve tried is:

HttpResponse<Stream> response = Unirest.post(“https://qrcode-monkey.p.mashape.com/qr/custom”)
.header(“X-Mashape-Key”, “<put license key in here>”)
.header(“Content-Type”, “application/json”)
.header(“Accept”, “application/json”)
.body("{“data”:“https://www.qrcode-monkey.com”,“config”:{“body”:“circle-zebra-vertical”,“eye”:“frame13”,“eyeBall”:“ball15”,“erf1”:[],“erf2”:[],“erf3”:[],“brf1”:[],“brf2”:[],“brf3”:[],“bodyColor”:"#0277BD",“bgColor”:"#FFFFFF",“eye1Color”:"#075685",“eye2Color”:"#075685",“eye3Color”:"#075685",“eyeBall1Color”:"#0277BD",“eyeBall2Color”:"#0277BD",“eyeBall3Color”:"#0277BD",“gradientColor1”:"#075685",“gradientColor2”:"#0277BD",“gradientType”:“linear”,“gradientOnEyes”:false,“logo”:"#facebook"},“size”:600,“download”:false,“file”:“png”}")
.asBinary();

Rapid account: Qrcode Monkey
qrcode-monkey Commented vor 6 Jahren

Sorry, I have no .NET skills and do not have any solution for c#.

The Unirest part should be almost the same… the raw_body to file is what you need to figure out.

Rapid account: Skimad 69
skimad69 Commented vor 6 Jahren

Thank you for this.

I don’t suppose you have a .NET (c#) version of the above script?

Rapid account: Qrcode Monkey
qrcode-monkey Commented vor 6 Jahren

Hi,

here is a PHP example for getting a response as PNG and saving it to a file:

$response = Unirest\Request::post(“https://qrcode-monkey.p.mashape.com/qr/custom”,
array(
“X-Mashape-Key” => MY KEY
"Content-Type" => “application/json”,
“Accept” => “application/json”
),
"{“data”:“https://www.qrcode-monkey.com”,“config”:{“body”:“circle-zebra-vertical”,“eye”:“frame13”,“eyeBall”:“ball15”,“erf1”:[],“erf2”:[],“erf3”:[],“brf1”:[],“brf2”:[],“brf3”:[],“bodyColor”:"#0277BD",“bgColor”:"#FFFFFF",“eye1Color”:"#075685",“eye2Color”:"#075685",“eye3Color”:"#075685",“eyeBall1Color”:"#0277BD",“eyeBall2Color”:"#0277BD",“eyeBall3Color”:"#0277BD",“gradientColor1”:"#075685",“gradientColor2”:"#0277BD",“gradientType”:“linear”,“gradientOnEyes”:false,“logo”:"#facebook"},“size”:600,“download”:false,“file”:“png”}"
);

file_put_contents(‘qrcode.png’, $response->raw_body);

Join in the discussion - add comment below:

Login / Signup to post new comments