Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your problem is the way you are constructing the URL. The spaces you are including in the query string will result in a malformed request URL being sent.</p> <p>Here is an example that replicates your circumstances:</p> <p><strong>request.php</strong>:</p> <pre><code>&lt;?php $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, 'http://your_server/response.php?foo=yes we can&amp;baz=foo bar' ); $content = curl_exec($ch); echo $content; </code></pre> <p><strong>response.php</strong>:</p> <pre><code>&lt;?php print_r($_GET); </code></pre> <p>The output of request.php is:</p> <pre><code>Array ( [foo] =&gt; yes ) </code></pre> <p>The reason for this is the query string is not properly encoded and the server interpreting the request assumes the URL ends at the first space, which in this case is in the middle of the query: <code>foo=yes we can&amp;baz=foo bar</code>.</p> <p>You need to build your URL using <a href="http://php.net/manual/en/function.http-build-query.php" rel="noreferrer">http_build_query</a>, which will take care of urlencoding your query string properly and generally makes the code look a lot more readable:</p> <pre><code>echo http_build_query(array( 'user'=&gt;'abc', 'password'=&gt;'xyz', 'msisdn'=&gt;'1234', 'sid'=&gt;'WebSMS', 'msg'=&gt;'Test message from SMSLane', 'fl'=&gt;0 )); </code></pre> <p>You also need to set CURLOPT_RETURNTRANSFER:</p> <pre><code>curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload