C++ and php cross-domain request issues
某草草
某草草 2017-05-24 11:31:02
0
2
493

The hardware supporting software was developed by c. Now c needs to send data to PHP through the 3G module. The data includes ordinary strings and image files.
I don’t know why the data array sent to me by c only has a pair of key values. The value is a string composed of all the data separated by English commas...
I didn’t care at first, I split it myself Dividing strings into arrays for processing can be done correctly.
But the image is a file and cannot be spliced ​​into a string.
c Just convert the picture into a binary string, use the same method to splice it with other data into a string and send it to me, and let me convert the binary string into a picture, but at this time I don’t know what to do I can't even receive it...
I don't understand c, and development can no longer proceed... Is this the right approach? Which side is the problem? What should be done correctly? Grateful

某草草
某草草

reply all(2)
大家讲道理

There is a problem with the way the question is asked, and it has nothing to do with cross-domain.
I provide two solutions
1. C++ calls the file upload interface of PHP, similar to the form upload file
2. The image is encoded in base64, and C++ passes the encoded string to you, and you can also parse it


3. You said you did not receive the content. You need to confirm this first. Either c++ failed or you did not receive it.
Whether it can be restored to an image through a binary string is a problem. No binary characters were received. Strings are another problem

小葫芦

It’s not a browser, there is no cross-domain problem.
This depends on the specific request protocol, such as:HTTP啥的,php接收图片也是用二进制啊Content-Type:multipart/form-data;

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!