Dawie de Villiers
asked on
Posting a values to a website
hi all
im trying to post a value to a webpage hosted by someone. My problem is the receipint website is not getting my post, im doing it like the code below.
Does anyone see what im doing wrong
im trying to post a value to a webpage hosted by someone. My problem is the receipint website is not getting my post, im doing it like the code below.
Does anyone see what im doing wrong
$post_to_url = 'http://webadd.gsm.co.za/XML/Send';
echo $Response;
$req = 'number=27795686787&message=testing';
$Message = $_REQUEST['mesg'];
$MobileNumber = $_REQUEST['num'];
//$result = mysql_query($query) or die("Couldn't select infor!55");
$ch = curl_init();
echo $post_to_url;
curl_setopt($ch, CURLOPT_URL,$post_to_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$buffer = curl_exec($ch);
curl_close($ch);
echo "Result=".$buffer;
ASKER
this variable $_REQUEST is fine
my problem is when i post to the other page(its not ours/ on a different website), they dont get my post
my problem is when i post to the other page(its not ours/ on a different website), they dont get my post
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
my mistake... i didn't notice the URL option...
ASKER
thnaks i will test that
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
140770FC:SSL routines:func(119):reason( 252)
im getting this error message if i put an error handler like this
curl_error($ch)
im getting this error message if i put an error handler like this
curl_error($ch)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thnaks guys the problem was my parameter list isnt working fine, so i added everything in the webadd
i wanted to specify the params on thier own.
Thanks guys
i wanted to specify the params on thier own.
Thanks guys
echo "mycellnumber=".$value;
echo "<br>"."Message=".$SendSMG;
$SendSMG = urlencode($SendSMG);
$username = 'test';
$password = 'test';
//$number = '27795686787';
$number = $value;
$message = 'Testing%20fromweb';
//$url = "https://www.myadd/XML/send/?username=test&password=test&number=27733218190&message=Testing%20fromweb"; $url = "https://www.xml2sms.gsm.co.za/send/?username=test&password=test&number=$value&message=$SendSMG";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
//curl_setopt ($ch, CURLOPT_PORT, $port);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$post_body = '';
$post_fields = array(
username => $username,
password => $password,
message => $message,
msisdn => $number
);
foreach($post_fields as $key=>$value)
{
$post_body .= urlencode($key).'='.urlencode($value).'&';
}
$post_body = rtrim($post_body,'&');
curl_setopt ($ch, CURLOPT_POSTFIELDS, $post_body);
$response_string = curl_exec($ch);
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
And are you getting that $_REQUEST from a form?