By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,557 Members | 1,406 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,557 IT Pros & Developers. It's quick & easy.

cURL Truncates Data..even with urlencode

P: 6
I am developing an application where i need cURL to transport data to the URL of the sms gateway api. The issue is that the data is being truncated.
The original data is something like
Expand|Select|Wrap|Line Numbers
  1. The Results For Your Son Pedro Have Been Released As Follows: 
  2.     Mathematics:97% English Language:58% Crk:59% Social Studies:67% 
  3.    Commerce:67% Government98% Biology: 100% Chemistry:78% 
  4.     geography:99% 
  5.      Religious Knowledge:Did Not Register
  6.     Economics:54%
  7.  
And what i get after using cURL is:
Expand|Select|Wrap|Line Numbers
  1. The Results For Your Son Pedro Have Been Released As Follows:
  2.    Mathematics:97% English Language:58% Crk:59% Social Studi
  3.  
My code to transfer the data is:
Expand|Select|Wrap|Line Numbers
  1. include 'sms_connect.php';
  2. $sql="select name from sms";
  3. $result=mysqli_query($link,$sql) or die("Error in sms".mysqli_error($link));
  4. while($row=mysqli_fetch_assoc($result))
  5. {$name=$row['name'];
  6.  
  7.  
  8. $url = "http://localhost/sms/index.php?name=".rawurlencode($name);
  9.  
  10. // create a new cURL resource
  11. $ch = curl_init();
  12.  
  13.  
  14. curl_setopt($ch, CURLOPT_URL, $url);
  15. curl_setopt($ch, CURLOPT_HEADER, 0);
  16.  
  17. $results = curl_exec($ch);
  18. var_dump($results);
  19.  
  20.  
  21.  
  22.  
  23. }
  24. curl_close($ch)
  25.  
Oct 12 '11 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.