Because the client program interacts with the third-party payment interface on the webpage, I think this can be implemented simply. Put a socket server on the third-party payment callback page, and the client program interacts with the socket server, in this way, the final business logic is processed. For socket programming in php, the simple instance code is as follows: SERVER :? Phpset_time_limit
Because the client program interacts with the third-party payment interface on the webpage, I think this can be implemented simply. Put a socket server on the third-party payment callback page, and the client program interacts with the socket server, in this way, the final business logic is processed. For socket programming in php, the simple instance code is as follows: SERVER :? Php set_time_limit
Because the client program interacts with the third-party payment interface on the webpage, I think this can be implemented simply. Put a socket server on the third-party payment callback page, and the client program interacts with the socket server, in this way, the final business logic is processed.
The simple example code for socket programming in php is as follows:
Server:
Client:
Interaction with c ++, client:
#include
#include
#pragma comment(lib,"ws2_32.lib") using namespace std; int main(int argc, char* argv[]) { WSADATA wsaData; WORD wVersionRequested=MAKEWORD(2,2); int err = WSAStartup(wVersionRequested,&wsaData); if (!err) { cout<<"inital socket success"<
>sendBuf; if (sendBuf==NULL) { break; } send(sock,sendBuf,strlen(sendBuf),0); Sleep(500); recv(sock,recvBuf,1024,0); cout<
Interaction with c/c ++ programs. The php server should read data in binary mode:
In addition, when sending data, \ 0 must be added at the end of the string:
Do {// $ buf = socket_read ($ connection, 1024, PHP_NORMAL_READ); $ buf = socket_read ($ connection, 1024, PHP_BINARY_READ ); // exit the connection condition var_dump ($ buf); if ($ buf = "quit") {socket_write ($ connection, "bye \ 0"); break ;} else if ($ buf = "isok") {socket_write ($ connection, "OK \ 0");} echo $ buf; socket_write ($ connection, "copy that \ 0");} while (1 );