Bez popisu

SourceController.php 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace App\Http\Controllers;
  3. use GuzzleHttp\Client;
  4. use Illuminate\Foundation\Bus\DispatchesJobs;
  5. use Illuminate\Routing\Controller as BaseController;
  6. use Illuminate\Foundation\Validation\ValidatesRequests;
  7. use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
  8. class SourceController extends BaseController
  9. {
  10. use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
  11. public function getSource()
  12. {
  13. $client = new Client();
  14. // $url = 'https://jzsc.mohurd.gov.cn/APi/webApi/dataservice/query/comp/list';
  15. $url = 'https://jzsc.mohurd.gov.cn/APi/webApi/dataservice/query/comp/list?complexname=%E5%9B%9B%E5%B7%9D%E9%A1%BA%E8%B5%90%E5%BB%BA%E7%AD%91%E5%8A%B3%E5%8A%A1%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8&pg=0&pgsz=15&total=0';
  16. $header = [
  17. 'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36',
  18. 'v' => 231012
  19. ];
  20. // $params = [
  21. // 'complexname' => '成都翔威建筑工程有限公司',
  22. // 'pg' => 0,
  23. // 'pgsz' => 15,
  24. // 'total' => 0
  25. // ];
  26. try {
  27. $res = $client->request('GET', $url, [
  28. 'headers' => ['User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36'],
  29. ]);
  30. } catch (\Exception $e) {
  31. dd($e);
  32. }
  33. dd($res);
  34. }
  35. }