import java.net.{URL, Proxy}
import scalaj.http.{Http, HttpRequest}
object Main {
def main(args: Array[String]): Unit = {
// 获取代理IP
val apiUrl = "http://api.ip.data5u.com/dynamic/get.html?order=你的提取码&sep=3"
val apiResp = Http(apiUrl).asString
val ipPort = apiResp.body.split(":")
// 使用代理请求目标网页
val proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(ipPort(0), ipPort(1).toInt))
val client = Http.configure(_.setProxy(proxy))
val bingResp = client.url("http://www.bing.com").asString
// 打印结果
println(bingResp.body)
}
}