简体   繁体   中英

remote sending post in cURL PHP

im trying to send sms remotly on address "smssheep.com" and i set all POST FIELDS and all and post but it wont work...

CODE:

$settings=array();
$settings["name"]="form1"; //name of form
$settings["no"]="0038268000000"; //mobile number
$settings["msg"]="TEST TEST MESAGE"; //message to send
$settings["submit"]="saveForm";
$settings["x_form_secret"]="**********";
$settings["idstamp"]="***************";

$url="http://smssheep.com/sendsms.php";

$ch=curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $settings);
curl_exec($ch);

Try this (I have stared some of your information in some of $settings indexes):

<?php

$settings = array();
$settings["name"] = "form1";
$settings["no"] = "*********";
$settings["msg"] = "TEST TEST MESAGE";
$settings["submit"] = "saveForm";
$settings["x_form_secret"] = "*********";
$settings["idstamp"] = "*********";

$settings = http_build_query($settings);

$url = "http://smssheep.com/sendsms.php";

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $settings);

curl_exec($ch);
curl_close($ch);

?>

And please do not post your secret information in public!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM