0

我找不到如何将自定义创建的 URL 发送到 Yourls。通常,Yourls 会返回随机生成的 URL,但我想指定特定的 URL 作为响应。

你的人通常会回来

http://test.it/8sj39

我想拥有它。我添加了变量 $articlenumber 但不知道如何发送

http://test.it/test1
http://test.it/doit

我的代码是在动态页面中实现的。短路将自动生成。

$shorturl = 'http://' . $_SERVER['HTTP_HOST']  . $_SERVER['REQUEST_URI'];
$signature = "12345678";
$siteurl = "http://test.it";
$articlenumber = $Artikel->cArtNr;

// Phases url
$yourlsinput = "".$siteurl."/yourls-api.php?action=shorturl&url=".$shorturl."&signature=".$signature."" ;

// Open phased url
$fh = fopen($yourlsinput, 'r') or die("can't open file");
//$yourlsoutput = fread($fh,filesize($yourlsinput));
$yourlsoutput = fread($fh,1024);
fclose($fh);

// Converts xml to php array
$xml = simplexml_load_string($yourlsoutput);
$json = json_encode($xml);
$array = json_decode($json,TRUE);
4

1 回答 1

1

您缺少keyword,您需要将$articlenumberaskeyword参数传递给 curl 以使其生成带有该关键字的链接。

于 2015-09-01T08:06:09.417 回答