我想用GET方法将参数发送到url,我使用file_get_content来执行此操作。 我的代码是:
$app_url = "http://localhost/index.php?number=%s&service_id=%s&shortcode=%s&msg=%s" ;
$msg = "Thank you for joining us! خوش آمدید";
$msg = urlencode($msg);
$address = sprintf($app_url , $current_user,$service_id,$scode,$msg);
$ret = file_get_contents($address);
echo $ret
它有效,并且没有问题,但是当我的$ msg很长时,我收到警告信息并且参数不会发送到网址:
Warning: file_get_contents(http://localhost/send_sms/index.php?number=123&service_id=test&shortcode=123&msg=Thank+u%%%%s%21%0A%D%%%%%8%B4%D9%85%D8%A7+%%%%%%D8%A8%D8%A7+%D9%85%%%%D9%%%%88%D9%81%D9%8