Custom QR Code with Logo

BEZAHLT
Durch qrcode-monkey | Aktualisiert 한 달 전 | Tools
Popularität

9.8 / 10

Latenz

786ms

Service Level

99%

Health Check

N/A

Zurück zu allen Diskussionen

Sample .NET code for creating QRCodes

Rapid account: Skimad 69
skimad69
6년 전

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 6년 전

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 6년 전

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 6년 전

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);

Nehmen Sie an der Diskussion teil - fügen Sie unten einen Kommentar hinzu:

Anmelden / Registrieren, um neue Kommentare zu veröffentlichen