Search code examples
phpconfigurationwechat

WeChat SandBox API Configuration Failed


I'm getting the "Configuration Failed" pop up after submitting my URL and Token in the WeChat sandbox environment. Could anyone suggest ways to debug or find a solution? Here are the details:

  • running a Heroku server and using the heroku generated URL.
  • pushed the sample code found in the documentation here
  • followed the youtube tutorial, copied the code and tried that as well.
<?php

$data[] = 'Test123';
$data[] = $_GET['timestamp'];
$data[] = $_GET['nonce'];

asort($data);

$strData = '';
$d = '';
$authString = '';
foreach($data as $d){
$authString .= $d;
}


//verify the signture 
if(sha1($authString) == $_GET[signature]){
//check if the echostr
    if(!empty($_GET['echostr'])){
    echo $_GET['echostr'];
    die();
}else{
//logic goes here
      $return = '<xml>
                <ToUserName><![CDATA['.$toUser.']]></ToUserName>
                <FromUserName><![CDATA['.$fromUser.']]></FromUserName>
                <CreateTime>'.time().'</CreateTime>
                <MsgType><![CDATA[text]]></MsgType>
                <Content><![CDATA['.$text.']]></Content>
                <FuncFlag>0</FuncFlag>
                </xml>';
                echo $return;
     }
}else{
     die('You are not supposed to be here');
}


?>
  • checked the logs and found that its working fine but shows no activity when I submit the URL and token on WeChat sandbox.
  • have tried different variations of URL, from using the root URL to finishing with the php file ie xxxx/responder.php
  • Token submitted matches Token used in code.
  • Uploading raw php to the server, hijacked the heroku php hello world app with the documentation code or youtube code.

The code itself comes straight from the WeChat Docs or the Youtube Video. Please let me know if I could provide any additional information.

Any advice, tips or hints would be really appreciated.


Solution

  • Please check. The sandbox environment was broken for International. This should be resolved now. Please test again