FriendsOfPHP / Goutte

Goutte, a simple PHP Web Scraper
MIT License
9.26k stars 1.01k forks source link

POST request not working properly. #330

Open farazirfan47 opened 6 years ago

farazirfan47 commented 6 years ago

I am sending POST request to "https://www.jkeats.com/sys/ajax/item/getprice" with parameters, here is my code. Parameters = $postData = [ 'form_params' => [ 'item' => 'NT-V-VNB241', 'language' => 'english', ]]; Request : $crawler = $client->request('POST', $price_url, $postData); In this way guzzle does not send parameters, but when I change $postData to $postData = [ 'item' => 'NT-V-VNB241', 'language' => 'english', ]; it worked. I don't know what the issue was when I send data inside form_params array, Please Advice. Thanks

dimzeta commented 4 years ago

I have the same issue. Thanks for advice!

Schyzophrenic commented 4 years ago

I experience the same, which also means that the query parameters are not taken into account. Something like

$params = [
    'query' => ['param1' => $myValue],
];

would not work while attaching these parameters in the URL will work...

EDIT: This is because Goutte no longer relies on Guzzle so we should not expect the same syntax... I ended up manually building my url with the parameters.