Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JSONP URL shorner_Url_Jsonp - Fatal编程技术网

JSONP URL shorner

JSONP URL shorner,url,jsonp,Url,Jsonp,我尝试了一些,但没有发现任何能够处理非常长的URL(大约2-3kb)。有没有可以处理非常长的URL并可以在JSONP(或其他纯客户端方式)中使用的URL缩短器?自己制作。如何创建自己的域,就是获得一个域,然后使用PHP和MySQLi将URL添加到数据库中,因此当您转到以下路径时: example.com/myurli 然后转到myurliofthebigestdomainintheworld.com谷歌的goo.gl URL压缩有一个RESTAPI,它接受跨域请求。不过,它需要创建一个API密钥

我尝试了一些,但没有发现任何能够处理非常长的URL(大约2-3kb)。有没有可以处理非常长的URL并可以在JSONP(或其他纯客户端方式)中使用的URL缩短器?

自己制作。如何创建自己的域,就是获得一个域,然后使用PHP和MySQLi将URL添加到数据库中,因此当您转到以下路径时: example.com/myurli
然后转到myurliofthebigestdomainintheworld.com

谷歌的goo.gl URL压缩有一个RESTAPI,它接受跨域请求。不过,它需要创建一个API密钥。然后可以像这样使用它

$.ajax("https://content.googleapis.com/urlshortener/v1/url?key=YOUR_KEY&alt=json",
{
  type: 'POST',      
  contentType: "application/json",
  data: JSON.stringify({        
    "longUrl": "http://something"
  })
}).done(function(data){
  var shortUrl = data.id
})