Model_ljg.php 778 B

1234567891011121314151617181920212223242526
  1. <?php
  2. class Model_ljg extends Lin_Model {
  3. function __construct(){
  4. parent::__construct();
  5. }
  6. public function get_enteradd($data)
  7. {
  8. $ch = curl_init();
  9. $url = 'http://ljg.xchuicheng.com/iotApi/syncStockIn';
  10. curl_setopt($ch,CURLOPT_URL,$url);
  11. curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  12. curl_setopt($ch,CURLOPT_HEADER,0);
  13. curl_setopt($ch,CURLOPT_POST, 1);
  14. curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,600);
  15. //设置post数据
  16. $post = array();
  17. $post['sku'] = $data['sku'];
  18. $post['title'] = $data['title'];
  19. $post['number'] = $data['number'];
  20. curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post));
  21. $res = curl_exec($ch);
  22. curl_close($ch);
  23. $res = json_decode($res,true);
  24. return $res;
  25. }
  26. } //end class