nghiahsgs

Untitled

Jun 6th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.89 KB | None | 0 0
  1. <?php  
  2. $typeDoiBong = array('0' =>'2399',
  3. '1' =>'2461',
  4. '2' =>'2649',
  5. '3' =>'2462',
  6. '4' =>'2463',
  7. '5' =>'2204',
  8. '6' =>'2464',
  9. '7' =>'2465',
  10. '8' =>'2466',
  11. '9' =>'2467'
  12.  
  13.  );
  14. $name=$_GET['name'];
  15. $number=$_GET['number'];
  16. echo '{  
  17.   "messages":[';
  18.  //echo "<br>";
  19. foreach ($typeDoiBong as $key => $value) {
  20.     # code...
  21.     //echo "$value";
  22.     $kq=getUrlAo($name,$number,$value);
  23.     if($key==9){
  24.         echo '{  
  25.         "attachment":{  
  26.            "type":"image",
  27.            "payload":{  
  28.               "url":"'.$kq.'"
  29.            }
  30.         }
  31.      }';
  32.     }else{
  33.         echo '{  
  34.         "attachment":{  
  35.            "type":"image",
  36.            "payload":{  
  37.               "url":"'.$kq.'"
  38.            }
  39.         }
  40.      },';
  41.     }
  42.    
  43.     //echo "<br>";
  44.  
  45. }
  46. echo "]
  47. }";
  48. function getUrlAo($name,$number,$type)
  49. {
  50.    
  51. $url="http://footballshirtmaker.com/en/create-fc-barcelona-soccer-jersey-with-your-name-and-number-".$type.".html";
  52.  
  53. //post
  54.  
  55.    
  56. $ch = curl_init();
  57.  
  58. curl_setopt($ch, CURLOPT_URL,$url);
  59. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36');
  60.    
  61. curl_setopt($ch,CURLOPT_ENCODING , '');
  62. curl_setopt($ch,CURLOPT_TIMEOUT , 15);
  63. curl_setopt($ch,CURLOPT_CONNECTTIMEOUT , 15);
  64.  
  65. curl_setopt($ch,CURLOPT_HEADER ,array('Content-Type: application/x-www-form-urlencoded'));
  66. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  67. curl_setopt($ch, CURLOPT_POST, 1);
  68. curl_setopt($ch, CURLOPT_POSTFIELDS,
  69.             "numero=".$number."&nombre=".$name."&Cambiar_Numero=Cambiar: undefined");
  70.  
  71.  
  72.  
  73. $data = curl_exec ($ch);
  74. $err=curl_error($ch);
  75. if($err){
  76.     echo "loi get data";
  77.     return 0;
  78. }else{
  79.     //echo $data;
  80.     preg_match('/temporales(.*?)"/', $data,$match);
  81.     //print_r($match);
  82.     $kq='http://footballshirtmaker.com/temporales'.$match[1];
  83.     return "$kq";
  84. }
  85.  
  86.  
  87. curl_close ($ch);
  88. }
  89.  
  90.  
  91.  ?>
Add Comment
Please, Sign In to add comment