File "index.php"

Full Path: /www/wwwroot/shphe-en.com/smsapi/index.php
File size: 1.29 KB
MIME-type: --
Charset: utf-8

<?php
require_once('../wp-load.php');

if(isset($_GET['country']) && $_GET['country']){
	$phones = get_option('sms_phone_num',true);
	if($phones){
	    $domain = home_url('/');
	    $url = "http://noticeapi.globalso.com/api/send_sms?phones=".$phones."&country=".$_GET['country']."&domain=".$domain;
	    $res = curl_c($url);
	    file_put_contents(__DIR__.'/results.log',date("Y-m-d H:i:s").'.'.$res.PHP_EOL,FILE_APPEND);
	}
	echo 200;
}
function curl_c($url){
    $header = array(
        'Expect:',
        'Content-Type: application/json; charset=utf-8'
    );
	$ch = curl_init($url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_HEADER, false);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
	curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246');
	curl_setopt($ch, CURLOPT_AUTOREFERER, true);
	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
	curl_setopt($ch, CURLOPT_TIMEOUT, 120);
	curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($ch, CURLOPT_SSLVERSION, 'all');
	curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
	$content = curl_exec($ch);
	curl_close($ch);
	return $content;
}