A więc napisałem skrypt api adf.ly króry działą na tej stronie shortbb.tk.
Znalazłem stronkę która ma takie samo api lecz zwraca mi błąd


Moj kod

index.php

  1. <?php
  2. include 'header.php';
  3. ?>
  4.  
  5.  
  6. <div class="contentbox">
  7.  
  8. <h1>Skracacz linków</h1>
  9.  
  10.  
  11.  
  12. <div id="short">
  13.  
  14. <div align="center">
  15. Wpisz długi link<br/>
  16. <form action="short.php" method="post" id="subscribeform">
  17. <input type="text" value="http://facebook.pl/" onfocus="if(this.value=='http://facebook.pl/'){this.value=''};" onblur="if(this.value==''){this.value='http://facebook.pl/'};" name="turl" id="turl">
  18. <input type="image" src="./images/short.png" name="submit" value="Skróc">
  19. </form>
  20. </div>
  21.  
  22. </div>
  23.  
  24.  
  25. <?php
  26. include 'footer.php';
  27. ?>



short.php

  1. <?php
  2.  
  3. if(isset($_POST['submit']))
  4. {
  5. function makeShort()
  6. {
  7. $turl = urlencode($_POST["turl"]);
  8.  
  9. $uid = "540";
  10. $key = "458b9dac8cca5216348c2782180ad1f6";
  11. $advert_type = "int";
  12. $domain = "zpag.es";
  13. $url = "http://zpag.es/api.php?key=".$key."&uid=".$uid."&advert_type=".$advert_type."&domain=".$domain."&url=".$turl."";
  14.  
  15. $ch = curl_init();
  16. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  17. curl_setopt($ch, CURLOPT_TIMEOUT, 1);
  18. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
  19. curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
  20. curl_setopt($ch, CURLOPT_URL, $url);
  21. $content = curl_exec($ch);
  22. curl_close($ch);
  23. return $content;
  24.  
  25. }
  26. ?>
  27. <?php
  28. echo"<div align='center'></div><br/>";
  29. $surl = makeShort();
  30. echo"<div align='center'>Twój skrócony link<br/>";
  31. echo"<strong><a href='$surl'>$surl</a></strong>";
  32. }
  33. ?>



Nie mam pojęcia czy to wina curl czy może czegoś innego mimo że api z adf.ly jest taki same

Możecie zarejestrować się tu link z moim ref
zPag.es