WhatsAPP CURL请求ID编码?

时间:2014-11-20 22:49:54

标签: php ssl curl get whatsapp

好吧,我正在为一个客户开发一个WhatsAPP通信器,我已经通过CURL从请求中获取了数据,但似乎ID是用我不知道的东西编码的?

在此寻找任何输入,我是否需要为SSL设置accessstoken?

$num = $_GET['num'];
$cc = $_GET['cc'];
$url = "https://v.whatsapp.net/v2/exist?in={$num}&cc={$cc}";
$accesstoken = randstr(40);
$headers = array();
$headers[] = 'Content-type: application/json';



//cURL starts
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$reply = curl_exec($ch);

//error handling for cURL
if ($reply === false) {
   // throw new Exception('Curl error: ' . curl_error($crl));
   print_r('Curl error: ' . curl_error($ch));
}
curl_close($ch);

$data = json_decode($reply, true);

我有回复

  

数组([status] => created [id] => giHIL4Cc2HahImIOSPDA7l4t8a4 = [sms_length] => 6 [voice_length] => 6)

但我不确定它是否正确回复,或者我是否应该随机化用户代理,我一直在找寻找方向。

0 个答案:

没有答案