Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7634555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:12:23+00:00 2026-05-31T07:12:23+00:00

I am trying to call an sms api using a http url .I am

  • 0

I am trying to call an sms api using a http url .I am trying to call the url using curl in php.I get a BAD REQUEST error .Please explain what I am doing wrong.

// create a new cURL resource
    $ch = curl_init();
    $string1 = "http://api.znisms.com/post/smsv3.asp?userid=alpesh67&apikey=74c6314840a16c5e7db00415a03181f7&message= Congratulation you have been successfully registered in the Placement Management System \n Email:".$email."\n Password:".$password."&senderid=PMS12345&sendto=".$contactno."";
    echo $string1;
    // set URL and other appropriate options
     curl_setopt($ch, CURLOPT_URL, $string1);
    // grab URL and pass it to the browser
    curl_exec($ch);
    //close cURL resource, and free up system resources
    curl_close($ch);
    //SMS END

I get the following error:

http://api.znisms.com/post/smsv3.asp?userid=alpesh67&apikey=74c6314840a16c5e7db00415a03181f7&message= Congratulation you have been successfully registered in the Placement Management System Email:alpeshhi@gmail.com Password:123456789&senderid=PMS12345&sendto=9773396773
Bad Request
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:12:24+00:00Added an answer on May 31, 2026 at 7:12 am

    You can’t use spaces in a URL. You need to url encode this string:

    &message= Congratulation you have been successfully registered in the Placement Management System \n Email:".$email."\n Password:".$password."
    

    http://php.net/manual/en/function.urlencode.php

    Returns a string in which all non-alphanumeric characters except -_.
    have been replaced with a percent (%) sign followed by two hex digits
    and spaces encoded as plus (+) signs. It is encoded the same way that
    the posted data from a WWW form is encoded, that is the same way as in
    application/x-www-form-urlencoded media type. This differs from the »
    RFC 3986 encoding (see rawurlencode()) in that for historical reasons,
    spaces are encoded as plus (+) signs.

    I would do something to the effect of:

    // create a new cURL resource
        $ch = curl_init();
        $encoded_message = urlencode( "Congratulation you have been successfully registered in the Placement Management System \n Email:".$email."\n Password:".$password)
        $string1 = "http://api.znisms.com/post/smsv3.asp?userid=alpesh67&apikey=74c6314840a16c5e7db00415a03181f7&message=".$encoded_message."&senderid=PMS12345&sendto=".$contactno."";
        echo $string1;
        // set URL and other appropriate options
         curl_setopt($ch, CURLOPT_URL, $string1);
        // grab URL and pass it to the browser
        curl_exec($ch);
        //close cURL resource, and free up system resources
        curl_close($ch);
        //SMS END
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to call a webservice using ssl. How do i get the
I'm trying to call a php webservice using WCF. I googled some public php
I'm trying to call the SQL statement below but get the following error: System.Data.SqlClient.SqlException:
When trying to call this function in my code i get the error in
I get this error trying call my service in WcfTestClient My config: <services> <service
When trying to call Close or Dispose on an SqlDataReader i get a timeout
While trying to call an EJB made using NETbeans (using jdk1.7) from a client
I trying to call some ejb bean method from tread. and getting error :
Trying to call from an android client, using the signpost oauth libs. I generated
Trying to call lang() function that is part of codeigniter's system/helpers (language_helper.php), resulting in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.