Need Help in HTTP Header
Posted: Wed Aug 29, 2007 3:58 am
hi,
i am trying to POST some info to a remote server which requires authentication. Below are the header and body style required by the remote server:
How i am gonna do with this? Below are my codes but somehow it is not working.
I was getting error response :
Even though the remote server had its firewall opened up for my access.
Please advise.
Thanks
i am trying to POST some info to a remote server which requires authentication. Below are the header and body style required by the remote server:
Code: Select all
POST /messaging.mobileway.com/yuuzoo_tes42477/yuuzoo_tes42477.sms HTTP/1.1
HOST: messaging.mobileway.com
Authorization: Basic dXNlcjpwYXNzd29yZA==
Content-Length: 160
Version=2.0
Subject=Test
[MSISDN]
List=+6593880590,+6591165669
[MESSAGE]
Text=TEST FROM DOS NUMBER 2
[SETUP]
OriginatingAddr=Yuuzoo
[END]Code: Select all
$header = "POST /messaging.mobileway.com/yuuzoo_tes42477/yuuzoo_tes42477.sms HTTP/1.1<LF>\n";
$header = $header."HOST: messaging.mobileway.com<LF>\n"."Authorization: Basic ".$authorize_login."<LF>";
$header = $header."\nContent-Length: 160<LF>\n";
//body
$header = $header."\nVersion=2.0<LF>\n";
$header = $header."Subject=Test<LF>\n";
$header = $header."[MSISDN]\nList=+6593880590,+6591165669<LF>";
$header = $header."\n[MESSAGE]\nText=TEST FROM DOS NUMBER 2<LF>\n";
$header = $header."[SETUP]\nOriginatingAddr=Yuuzoo<LF>\n";
$header = $header."[END]<LF>";
$url = "http://messaging.mobileway.com/yuuzoo_tes42477/yuuzoo_tes42477.sms";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS,$header);
$fwdresult = curl_exec($curl);
curl_close($curl);Code: Select all
Authorization Required
This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.Please advise.
Thanks