-3

I am trying to send sms and my url with numbers is "http://api.appname.my/sendSms.php?message=hello&phone=687985<6123488<60149041982" but it get shorten to this "http://api.appname.my/sendSms.php?message=hello&phone=687985" so why it is removing other numbers.Here is my code

  number = number + "60149041982"

    let url = "http://api.appname.my/sendSms.php?message=hello&phone=\(number)"

    Alamofire.request(url).response{ (responseObject) -> Void in
    print(responseObject)

    }
Rahul Gupta
  • 501
  • 1
  • 7
  • 15

1 Answers1

1

I think your should encode the < character to %3C

let urlString = "http://api.appname.my/sendSms.php?message=hello&phone=\(number)"
let url = urlString.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
print("Result: " + url!)

// Result: http://api.appname.my/sendSms.php?message=hello&phone=687985%3C6123488%3C60149041982
Danh Huynh
  • 2,337
  • 1
  • 15
  • 18