Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Midjourney API in PHP

Please help me connect to the Midjourney API via PHP. I need an intermediary service that can provide a stable service at an affordable price for creating AI-generated images using the Midjourney AI via the API.
Please also send the necessary codes for the connection.

Thank you in advance.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can use the Midjorney API by TalkBaBa.com. This service connects you to the latest generation of AI-powered image generator. You can also create an image with Midjorney through the web mode using the link below.

Midjourney AI Image Generator

And you can access the web service documentation for PHP through the link below.

Midjourney Web Service Documents

Here is a sample PHP code for creating an image with Midjorney via the Midjorney API:

<?php
$headers = [
    'Authorization: Bearer YOUR-TOKEN-KEY'
];
$data = [
    'promot' => 'an image promot',
    'aspectRatio' => '4:3'
];
$url = 'https://api.talkbaba.com/v1/media/midjorney/REQ';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo $response = curl_exec($ch);
if(curl_errno($ch)){
    echo 'Error in executing CURL request: ' . curl_error($ch);
}
curl_close($ch);
?>

It should be noted that you can still use the DALLE AI image generator and Google Image in TalkBaBa.

Good luck.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading