I have a code that I tested with localhost, it works, but it doesn’t work on the host. I tried several services, none of them worked. If possible, tell me where the problem is.
here is my code:
<form action="" method="post">
<textarea name="h"> text box</textarea><input type="submit">
</form>
<?php
$h=$_POST["h"];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://example.com');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
'Accept-Language: fa-IR,fa;q=0.9,en-US;q=0.8,en;q=0.7',
'Cache-Control: max-age=0',
'Connection: keep-alive',
'Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryhdhdjjddjd726',
'Origin: https://example.ir',
'Referer: https://example.ir/admin/41373153',
'Sec-Fetch-Dest: document',
'Sec-Fetch-Mode: navigate',
'Sec-Fetch-Site: same-origin',
'Sec-Fetch-User: ?1',
'Upgrade-Insecure-Requests: 1',
'User-Agent: Mozilla/5.0 (Linux; Android 9; Redmi 8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Mobile Safari/537.36',
'sec-ch-ua: "Not:A-Brand";v="99", "Chromium";v="112"',
'sec-ch-ua-mobile: ?1',
'sec-ch-ua-platform: "Android"',
'Accept-Encoding: gzip',
]);
curl_setopt($ch, CURLOPT_COOKIE, 'SESSIONID=mysession');
curl_setopt($ch, CURLOPT_POSTFIELDS, "------WebKitFormBoundaryhsjsksksk82728jJsjsjrnContent-Disposition: form-data; name="___TOKEN_FORM___"rnrJsjsjsjdjdjjdz837373jxjxrn------WebKitFormBoundaryhshsjssj8272jzjJrnContent-Disposition: form-data; name="title"rnrnmsgrn------WebKitFormBoundarymdudjdjdjrnContent-Disposition: form-data; name="text"rnrn".$h."rn------WebKitFormBoundaryyesjdjd737rnContent-Disposition: form-data; name="datetimeSend"rnrn۱۴۰۲/۰۵/۰۳ ۰۸:۵۱:٠٠rn------ddgdddhrnContent-Disposition: form-data; name="state"rnrnsendingrn------WebKitFormBoundaryjzjzjzjz837JjdrnContent-Disposition: form-data; name="m_dateTimeDelete"rnrnrn------WebKitFormBoundaryhxhdjdjhdh7rnContent-Disposition: form-data; name="d_dateTimeDelete"rnrnrn------udjdjjdjdjdjdrnContent-Disposition: form-data; name="h_dateTimeDelete"rnrnrn------jdjdjdjdjdjdrnContent-Disposition: form-data; name="i_dateTimeDelete"rnrnrn------usussududuudrnContent-Disposition: form-data; name="viewCountForDelete"rnrnrn------uuuddjjd83837j--rn");
$rrj = curl_exec($ch);
print_r($rrj);
curl_close($ch);
I tested with localhost, it works, but it doesn’t work on the host. I tried several services, none of them worked. If possible, tell me where the problem is?
help me please