Connecting Tech Pros Worldwide Help | Site Map

Curl and Sending query string to SMPP server

  #1  
Old November 15th, 2008, 03:45 AM
lakmarket
Guest
 
Posts: n/a
Hi,

I am trying to send some querysting using cURL. This is the working
API

http://smpp4.routesms.com:8080/bulks...ge=testmessage.

The infomation given by Routesms.com:

Port: 2345
Server: SMPPHTTP

This is my code:

$ch = curl_init();
$url = "http://smpp4.routesms.com:8080/bulksms/bulksms?
username=xxxxxx&password=xxxxxxx&type=0&dlr=0&dest ination=94xxxxxxxxx&source=testing&message=testmes sage";
curl_setopt($ch,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$result = curl_exec($ch);
if(!$result){
echo "Failed<br>";
}

Following results are expected.

1701 = Success
1702 = Invalid URL Error
1703 = Invalid value in username or password field
1704 = Invalid value in "type" field
1705 = Invalid Message
1706 = Invalid Destination
1707 = Invalid Source (Sender)
1708 = Invalid value for "DLR" field
1709 = User validation failed
1710 = Internal Error
1025 = Insufficient Credit

Bu nothing is coming other than Failed.

Pls help me. Thank you in advance.

Lakmarket
  #2  
Old November 15th, 2008, 04:25 AM
Jerry Stuckle
Guest
 
Posts: n/a

re: Curl and Sending query string to SMPP server


lakmarket wrote:
Quote:
Hi,
>
I am trying to send some querysting using cURL. This is the working
API
>
http://smpp4.routesms.com:8080/bulks...ge=testmessage.
>
The infomation given by Routesms.com:
>
Port: 2345
Server: SMPPHTTP
>
This is my code:
>
$ch = curl_init();
$url = "http://smpp4.routesms.com:8080/bulksms/bulksms?
username=xxxxxx&password=xxxxxxx&type=0&dlr=0&dest ination=94xxxxxxxxx&source=testing&message=testmes sage";
curl_setopt($ch,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$result = curl_exec($ch);
if(!$result){
echo "Failed<br>";
}
>
Following results are expected.
>
1701 = Success
1702 = Invalid URL Error
1703 = Invalid value in username or password field
1704 = Invalid value in "type" field
1705 = Invalid Message
1706 = Invalid Destination
1707 = Invalid Source (Sender)
1708 = Invalid value for "DLR" field
1709 = User validation failed
1710 = Internal Error
1025 = Insufficient Credit
>
Bu nothing is coming other than Failed.
>
Pls help me. Thank you in advance.
>
Lakmarket
What does curl_error() show?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
  #3  
Old November 15th, 2008, 04:45 AM
lakmarket
Guest
 
Posts: n/a

re: Curl and Sending query string to SMPP server


On Nov 15, 1:17*pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
lakmarket wrote:
Quote:
Hi,
>
Quote:
I am trying to *send some querysting *using cURL. This is the working
API
>>
Quote:
The infomation given by Routesms.com:
>
Quote:
Port: 2345
Server: SMPPHTTP
>
Quote:
This is my code:
>
Quote:
$ch = curl_init();
$url = "http://smpp4.routesms.com:8080/bulksms/bulksms?
username=xxxxxx&password=xxxxxxx&type=0&dlr=0&dest ination=94xxxxxxxxx&source=testing&message=testmes sage";
curl_setopt($ch,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$result = curl_exec($ch);
if(!$result){
echo "Failed<br>";
}
>
Quote:
Following results are expected.
>
Quote:
*1701 = Success
*1702 = Invalid URL Error
*1703 = Invalid value in username or password field
*1704 = Invalid value in "type" field
*1705 = Invalid Message
*1706 = Invalid Destination
*1707 = Invalid Source (Sender)
*1708 = Invalid value for "DLR" field
*1709 = User validation failed
*1710 = Internal Error
*1025 = Insufficient Credit
>
Quote:
Bu nothing is coming other than Failed.
>
Quote:
Pls help me. * Thank you in advance.
>
Quote:
*Lakmarket
>
What does curl_error() show?
>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
The only message display on the screen is "Failed". Do I have to
insert curl_error() somewhere in the code?


Thank you
  #4  
Old November 15th, 2008, 08:25 AM
Michael Gooden
Guest
 
Posts: n/a

re: Curl and Sending query string to SMPP server


On Nov 15, 6:37 am, lakmarket <lakmar...@gmail.comwrote:
Quote:
On Nov 15, 1:17 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>
>
>
Quote:
lakmarket wrote:
Quote:
Hi,
>
Quote:
Quote:
I am trying to send some querysting using cURL. This is the working
API
>>
Quote:
Quote:
The infomation given by Routesms.com:
>
Quote:
Quote:
Port: 2345
Server: SMPPHTTP
>
Quote:
Quote:
This is my code:
>
Quote:
Quote:
$ch = curl_init();
$url = "http://smpp4.routesms.com:8080/bulksms/bulksms?
username=xxxxxx&password=xxxxxxx&type=0&dlr=0&dest ination=94xxxxxxxxx&source=testing&message=testmes sage";
curl_setopt($ch,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$result = curl_exec($ch);
if(!$result){
echo "Failed<br>";
}
>
Quote:
Quote:
Following results are expected.
>
Quote:
Quote:
1701 = Success
1702 = Invalid URL Error
1703 = Invalid value in username or password field
1704 = Invalid value in "type" field
1705 = Invalid Message
1706 = Invalid Destination
1707 = Invalid Source (Sender)
1708 = Invalid value for "DLR" field
1709 = User validation failed
1710 = Internal Error
1025 = Insufficient Credit
>
Quote:
Quote:
Bu nothing is coming other than Failed.
>
Quote:
Quote:
Pls help me. Thank you in advance.
>
Quote:
Quote:
Lakmarket
>
Quote:
What does curl_error() show?
>
Quote:
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
>
The only message display on the screen is "Failed". Do I have to
insert curl_error() somewhere in the code?
>
Thank you
No, when you incurr curl_error() you will get what curl is saying is
wrong.
  #5  
Old November 15th, 2008, 09:15 AM
lankansoft
Guest
 
Posts: n/a

re: Curl and Sending query string to SMPP server


On Nov 15, 5:24*pm, Michael Gooden <m...@michael-gooden.infowrote:
Quote:
On Nov 15, 6:37 am, lakmarket <lakmar...@gmail.comwrote:
>
>
>
Quote:
On Nov 15, 1:17 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>
Quote:
Quote:
lakmarket wrote:
Hi,
>
Quote:
Quote:
I am trying to *send some querysting *using cURL. This is the working
API
>>
Quote:
Quote:
The infomation given by Routesms.com:
>
Quote:
Quote:
Port: 2345
Server: SMPPHTTP
>
Quote:
Quote:
This is my code:
>
Quote:
Quote:
$ch = curl_init();
$url = "http://smpp4.routesms.com:8080/bulksms/bulksms?
username=xxxxxx&password=xxxxxxx&type=0&dlr=0&dest ination=94xxxxxxxxx&source=testing&message=testmes sage";
curl_setopt($ch,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$result = curl_exec($ch);
if(!$result){
echo "Failed<br>";
}
>
Quote:
Quote:
Following results are expected.
>
Quote:
Quote:
*1701 = Success
*1702 = Invalid URL Error
*1703 = Invalid value in username or password field
*1704 = Invalid value in "type" field
*1705 = Invalid Message
*1706 = Invalid Destination
*1707 = Invalid Source (Sender)
*1708 = Invalid value for "DLR" field
*1709 = User validation failed
*1710 = Internal Error
*1025 = Insufficient Credit
>
Quote:
Quote:
Bu nothing is coming other than Failed.
>
Quote:
Quote:
Pls help me. * Thank you in advance.
>
Quote:
Quote:
*Lakmarket
>
Quote:
Quote:
What does curl_error() show?
>
Quote:
Quote:
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
>
Quote:
The only message display on the screen is "Failed". Do I have to
insert curl_error() somewhere in the code?
>
Quote:
Thank you
>
No, when you incurr curl_error() you will get what curl is saying is
wrong.
Thanks for the information

curl_error() message is: No URL set!

If somebody willing to help I can email the test account username and
password.

Regards,

Lakmarket
  #6  
Old November 15th, 2008, 10:45 AM
lankansoft
Guest
 
Posts: n/a

re: Curl and Sending query string to SMPP server


Hi,

I did some corrections of the program.

$url = "http://smpp4.routesms.com:8080/bulksms/bulksms?
username=xxxxxxx&password=xxxxx&type=0&dlr=0&desti nation=xxxxxx&source=xxxxxx&message=testscriptold" ;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);


if(!curl_exec($ch))
{
echo 'Curl error: ' . curl_error($ch);
}
else
{
echo 'Operation completed without any errors';
}

Now the output is Curl error: couldn't connect to host

Thanks
  #7  
Old November 15th, 2008, 02:15 PM
Jerry Stuckle
Guest
 
Posts: n/a

re: Curl and Sending query string to SMPP server


lankansoft wrote:
Quote:
Hi,
>
I did some corrections of the program.
>
$url = "http://smpp4.routesms.com:8080/bulksms/bulksms?
username=xxxxxxx&password=xxxxx&type=0&dlr=0&desti nation=xxxxxx&source=xxxxxx&message=testscriptold" ;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
>
>
if(!curl_exec($ch))
{
echo 'Curl error: ' . curl_error($ch);
}
else
{
echo 'Operation completed without any errors';
}
>
Now the output is Curl error: couldn't connect to host
>
Thanks
That's because "http://smpp4.routesms.com:8080/bulksms/bulksms?
username=xxxxxxx&password=xxxxx&type=0&dlr=0&desti nation=xxxxxx&source=xxxxxx&message=testscriptold" ;

is not a URL. It is a URL and a query parameter list.

Only the URL is passed in CURLOPT_URL. The parameter list is passed in
CURLOPT_POSTFIELDS.

I'd recommend you google for a CURL tutorial. It will help you a lot.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Closed Thread