ERP 시스템은 데이터를 위챗 공식 계정과 연동해야 하기 때문에 현재 중간 서버 구축을 준비 중입니다.
개발 환경: 추적 결과 서버가 WeChat으로부터 GET 요청을 수신할 수 없는 것으로 나타났습니다. 코드는 다음과 같습니다:
델파이/파스칼 코드?
interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, IdBaseComponent, IdComponent, IdCustomTCPServer, IdCustomHTTPServer, IdHTTPServer, IdContext, IdHashSHA, IdGlobal; type TForm1 = class(TForm) IdHTTPServer1: TIdHTTPServer; Button1: TButton; Memo1: TMemo; procedure Button1Click(Sender: TObject); procedure IdHTTPServer1CommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo); private { Private declarations } public { Public declarations } function SHA1(Input: String): String; function CheckSignature(ARequestInfo: TIdHTTPRequestInfo): boolean; end; var Form1: TForm1; Const Token = 'weixin'; implementation {$R *.dfm} function TForm1.SHA1(Input: String): String; begin with TIdHashSHA1.Create do try Result := LowerCase(HashBytesAsHex(TidBytes(Bytesof(Input)))); finally Free; end; end; function TForm1.CheckSignature(ARequestInfo: TIdHTTPRequestInfo): boolean; var signature, timestamp, nonce, echostr: String; tmpstr: TStringList; temp: String; begin tmpstr := TStringList.Create; try signature := ARequestInfo.Params.Values['signature']; timestamp := ARequestInfo.Params.Values['timestamp']; nonce := ARequestInfo.Params.Values['nonce']; echostr := ARequestInfo.Params.Values['echostr']; tmpstr.Add(Token); tmpstr.Add(timestamp); tmpstr.Add(nonce); tmpstr.Sort; temp := StringReplace(tmpstr.text, #13#10, '', [rfReplaceAll]); Result := SHA1(temp) = signature; finally tmpstr.Free; end; end; procedure TForm1.Button1Click(Sender: TObject); begin IdHTTPServer1.Active := True; end; procedure TForm1.IdHTTPServer1CommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo); begin Memo1.Lines.Add('123'); if CheckSignature(ARequestInfo) then if ARequestInfo.Params.Values['echostr'] <> '' then begin Memo1.Lines.Add(ARequestInfo.Params.Values['echostr']); AResponseInfo.ContentType := 'text/html; charset=UTF-8'; AResponseInfo.ContentText := ARequestInfo.Params.Values['echostr']; end; end; end.
위 내용은 WeChat 서버 인터페이스 개발을 위한 예제 튜토리얼의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

MinGW - Windows용 미니멀리스트 GNU
이 프로젝트는 osdn.net/projects/mingw로 마이그레이션되는 중입니다. 계속해서 그곳에서 우리를 팔로우할 수 있습니다. MinGW: GCC(GNU Compiler Collection)의 기본 Windows 포트로, 기본 Windows 애플리케이션을 구축하기 위한 무료 배포 가능 가져오기 라이브러리 및 헤더 파일로 C99 기능을 지원하는 MSVC 런타임에 대한 확장이 포함되어 있습니다. 모든 MinGW 소프트웨어는 64비트 Windows 플랫폼에서 실행될 수 있습니다.

WebStorm Mac 버전
유용한 JavaScript 개발 도구

SecList
SecLists는 최고의 보안 테스터의 동반자입니다. 보안 평가 시 자주 사용되는 다양한 유형의 목록을 한 곳에 모아 놓은 것입니다. SecLists는 보안 테스터에게 필요할 수 있는 모든 목록을 편리하게 제공하여 보안 테스트를 더욱 효율적이고 생산적으로 만드는 데 도움이 됩니다. 목록 유형에는 사용자 이름, 비밀번호, URL, 퍼징 페이로드, 민감한 데이터 패턴, 웹 셸 등이 포함됩니다. 테스터는 이 저장소를 새로운 테스트 시스템으로 간단히 가져올 수 있으며 필요한 모든 유형의 목록에 액세스할 수 있습니다.

Dreamweaver Mac版
시각적 웹 개발 도구

안전한 시험 브라우저
안전한 시험 브라우저는 온라인 시험을 안전하게 치르기 위한 보안 브라우저 환경입니다. 이 소프트웨어는 모든 컴퓨터를 안전한 워크스테이션으로 바꿔줍니다. 이는 모든 유틸리티에 대한 액세스를 제어하고 학생들이 승인되지 않은 리소스를 사용하는 것을 방지합니다.
