Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP] lotto skrypt do wyników
LoteriaLiczbowa
post 19.06.2018, 16:29:50
Post #1





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 30.04.2018

Ostrzeżenie: (0%)
-----


Cześć, kolega napisał mi krótki kod aczkolwiek nie działa dla mnie na stronie
  1. <?php
  2. $ch = curl_init();
  3. curl_setopt($ch, CURLOPT_URL,"http://app.lotto.pl/wyniki/?type=".$_GET['type']."");
  4. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  5. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  6. curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; pl-PL; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
  7. $server_output = curl_exec ($ch);
  8. curl_close ($ch);
  9.  
  10. // Set the content-type
  11. header('Content-Type: image/png');
  12.  
  13. // Create the image
  14. $im = imagecreatetruecolor(150, 150);
  15. function skrut($c,$d) {
  16. if(strlen($c) > $i) { //sprawdzanie czy tekst jest dłuzszy niz ustaliliśmy
  17. $ciag = substr($c,0,$d); //jesli tak, to obcina ciąg...
  18. $ciag .=""; //...dodaje kropki...
  19. return $ciag; //... i zwraca zmodyfikowany ciąg
  20. }
  21. else return $c; //jesli nie to zwraca wprowadzony ciąg
  22. }
  23.  
  24. // Create some colors
  25. $white = imagecolorallocate($im, 255, 255, 255);
  26. $grey = imagecolorallocate($im, 128, 128, 128);
  27. $black = imagecolorallocate($im, 0, 0, 0);
  28. imagefilledrectangle($im, 0, 0, 250, 180, $white);
  29. $go = imagecreatefrompng('http://lotto-sposob.pl/wp-content/uploads/2016/02/lotto-250x250.png');
  30. imagecopy($im, $go,25,25,10,50,250,250);
  31. imagedestroy($go);
  32. // The text to draw
  33. $text = "20".$server_output[2].$server_output[3].$server_output[4].$server_output[5].$server_output[6].$server_output[7].$server_output[8].$server_output[9].$server_output[10];
  34. $text2 = $server_output[11].$server_output[12].$server_output[13].$server_output[14].$server_output[15].$server_output[16].$server_output[17].$server_output[18].$server_output[19].$server_output[20].$server_output[21].$server_output[22].$server_output[23].$server_output[24].$server_output[25].$server_output[26];
  35. $strxx = array('', '', ''); // kasowanie @ pukawka.pl i zabijaka.pl
  36. $str2xx = array('-', 'w', ''); // na co zamienic @ pukawka.pl i zabijaka.pl
  37. $text2 = str_replace($strxx, $str2xx, $text2);
  38. // Replace path by your own font path
  39. $font = 'visitor.ttf';
  40.  
  41. // Add some shadow to the text
  42. imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
  43. imagettftext($im, 20, 0, 11, 34, $grey, $font, $text2);
  44. // Add the text
  45. imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
  46.  
  47. // Using imagepng() results in clearer text compared with imagejpeg()
  48. imagepng($im);
  49. imagedestroy($im);
  50. ?>


Skrypt znajduję się pod tym linkiem - https://lottoforum.pl/wyniki/
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 29.03.2024 - 12:29