0

I have a PHP script which in theory should send some parameters to a Node.js/Express Javascript bot running on glitch (I know it is not the best option but it is not the problem).

<?php

$URL = curl_init('XXXXXXXXXXXXXXXXXXXXXX.glitch.me/bot?say=1');
curl_setopt($URL, CURLOPT_POST, 1);
echo curl_exec($URL);
curl_close($URL);

?>

When I try to run the code, which is hosted on a website, it does nothing and I get the 400 Bad Request error. Can someone help?

EDIT: https://testforwebsite21324141.000webhostapp.com/ is the website with the php running. It does not send anything to my bot, when it is running and working. There are also no errors in the logs.

brrrrrrr
  • 13
  • 7
  • That url doesnt exist so it's a 404 – chiliNUT Nov 27 '20 at 18:55
  • So, where's the error reponse from? The curl_exec echo, or "on a website"? Maybe your target doesn't like bots? – mario Nov 27 '20 at 18:55
  • The website is working and online. It just does not send. I am not really sure how to explain what I am trying to do. I am trying to send some parameters to a link I guess. – brrrrrrr Nov 27 '20 at 19:01
  • Also, it is not a 404 error. I get a 400 Bad Response error like I said in my post. – brrrrrrr Nov 27 '20 at 19:03
  • @KnightGamer728 Please [edit] your question to include the actual code or URL you are trying to call. Also explain in detail what you are trying to do and what data you want to send. Provide a [mcve] which shows how to get the error message you get. – Progman Nov 27 '20 at 19:05
  • @KnightGamer728 For debugging purposes, use `CURLOPT_VERBOSE` to see the request you are sending (you might need to set `CURLOPT_STDERR`). – Progman Nov 27 '20 at 19:08
  • I am new to PHP so please explain. – brrrrrrr Nov 27 '20 at 19:15
  • you need to post something, and if your echo'ing the response you also need set to return transfer – Lawrence Cherone Nov 27 '20 at 19:15
  • I already did POST something though? – brrrrrrr Nov 27 '20 at 19:17

0 Answers0