<?php $myCurl = curl_init(); $data = array( 'saleid'=>'328751050', 'location'=>'shop_browse', 'amount'=>'285', 'internal_search'=>'', 'csrf'=>'xxxxxxxxxxxxxxxxxxxx' ); curl_setopt( $myCurl, CURLOPT_URL, 'https://api.opskins.com/ICart/AddToCart/v1/' ); curl_setopt( $myCurl, CURLOPT_HTTPHEADER, array ( 'origin: https://opskins.com', 'accept-encoding: gzip, deflate, br', 'accept-language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7', 'user-agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36', 'content-type: application/x-www-form-urlencoded; charset=UTF-8', 'accept: */*', 'referer: https://opskins.com/?loc=shop_browse&app=730_2', 'authority: api.opskins.com', 'cookie: chok=chok1; woop=woop; yes=no', )); curl_setopt($myCurl,CURLOPT_ENCODING, ''); curl_setopt($myCurl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($myCurl, CURLOPT_COOKIEFILE, ''); curl_setopt($myCurl, CURLOPT_HEADER, 0); curl_setopt($myCurl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($myCurl, CURLOPT_PROXYPORT, '8000'); curl_setopt($myCurl, CURLOPT_PROXY, '1.1.1.1'); curl_setopt($myCurl, CURLOPT_PROXYUSERPWD, 'xxxx:xxxxxx'); curl_setopt( $myCurl, CURLOPT_POST, 1 ); curl_setopt($myCurl, CURLOPT_POSTFIELDS, $data); curl_setopt ($myCurl, CURLOPT_SSL_VERIFYPEER, 0); echo 'Error curl: ' . curl_error($myCurl); curl_close($myCurl); ?> 

I try to press a button on the target site, the action does not pass, does not return an error.

screenshots

  • ? there is no mistake - Naumov
  • @Naumov "403 Forbidden Missing or invalid CSRF token.OK !!" Token rechecked, everything is exactly a mistake - Udachnik

1 answer 1

Because your "error output" is unconditional, and the request itself is not executed.

Need to:

 if (curl_exec ( $myCurl )) echo 'OK!!'; // сделать что-то полезное по обработке вашего запроса else echo 'Error curl: ' . curl_error($myCurl); 
  • Fixed, now loading blank page - Udachnik
  • The output of the result is not mandatory, first you need to pass a POST request that is sent when you press the button - Udachnik
  • You have the CURLOPT_RETURNTRANSFER option installed. This means that curl_exec will return the response from the server as the result of a function, and not print it on the page. - 7px
  • for sure)). I look at the book I see a fig. Removed now "403 Forbidden Missing or invalid CSRF token.OK !!" Token checked again, is correct. But the mistake - Udachnik
  • and it depends on the server script, if the token is all right. - 7px