1

These codes throw "Bad Request" error because of parameter. What is the problem of parameter syntax.

try{         
    $client = new Client();    
    $response = $client->post("url",
    ['s' => $s, 'p'=> $p]);
    
    } catch (ClientException $e) {
        echo $e->getMessage();
    } catch (RequestException $e) {
        echo $e->getMessage();
      }
Bayaz
  • 45
  • 9
  • 1
    it is just a simple guzzle post request I would suggest to read guzzle docs. – bhucho Feb 23 '22 at 17:42
  • 1
    Does this answer your question? [How can I use Guzzle to send a POST request in JSON?](https://stackoverflow.com/questions/22244738/how-can-i-use-guzzle-to-send-a-post-request-in-json) – bhucho Feb 23 '22 at 17:44
  • Unfortunetely still problem is continue @bhucho – Bayaz Feb 24 '22 at 03:01
  • 1
    you want to use query parameters? see [this](https://docs.guzzlephp.org/en/latest/quickstart.html#query-string-parameters) – bhucho Feb 24 '22 at 14:53

1 Answers1

1

You can use Http::post();

use Illuminate\Support\Facades\Http;
$response =  Http::post('http://example.com/users',['your data']);
Wael Khalifa
  • 895
  • 7
  • 17