shell_exec curl to GraphQL API – Bad Request

shell_exec curl to GraphQL API – Bad Request


0

I’m trying play with a website’s GraphQL API (https://www.xxxlutz.hu/api/graphql) to scrape data. In Altair working fine, but I need to run in PHP with curl_impersonate to bypass Cloudflare.

I tried this, and working fine:

shell_exec curl to GraphQL API - Bad Request

$d = '{"query":"query {navigation(codes: ["header_nav_root"], levelAmount:2 , levelOffset:0){data}}"}';
$curl_impersonate_exec_command = '/usr/local/bin/curl_chrome100 -g -L  "' . $url . '" -X POST  -H "Accept: application/json" -H "Content-Type: application/json" -d '' . $d.' '' ;
        
$response = shell_exec($curl_impersonate_exec_command);
        
echo $response;
        

I tried another query, but something wrong with my query string, maybe in "filters" param. I tried many ways, but I receive "bad request".

in Altair working fine, but in php curl don’t …
altair

Without filters, looks working fine, error message, "filters" missing. Ok.

$d = '{"query":"query {getSearchResults(cid: "",pagination: "{page:1,numberOfResults:60}", sortBy: "available"   ) {    rid  }}"}';
        
$curl_impersonate_exec_command = '/usr/local/bin/curl_chrome100 -g -L  "' . $url . '" -X POST  -H "Accept: application/json" -H "Content-Type: application/json" -d '' . $d.' '' ;
        
$response = shell_exec($curl_impersonate_exec_command);
       
echo $response;
        

I’m tried to add filters, but I can’t figure out the right syntax

 filters: "[{"id": "categories","type": "categoryFilter","values":["C1","C1C9","C1C9C1"]}]",`

Can someone help?

New contributor

user22567479 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


Load 7 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *