This question already has an answer here:

here is my configuration : Apache2 working with php7.1.

I have an example PHP code for sending a sms message specific to JasminSMS :

// Sending simple message using PHP
// http://jasminsms.com

$baseurl = ''

$params = '?username=foo'
$params.= '&password=bar'
$params.= '&to='.urlencode('+336222172')
$params.= '&content='.urlencode('Hello world !')

$response = file_get_contents($baseurl.$params);

But it does not working and give me error 500.

I have two examples that works well:


curl -d "username=foo&password=bar&dlr=yes&dlr-level=3&to=xxxxxxxxxx&from=InfoMessage&dlr-url=http://exemple.com/dlr.php&content=hello !"

I need to turn them into php queries and found them next exemples :

$ch = curl_init("");
$fp = fopen("username=foo&password=bar&dlr=yes&dlr-level=3&to=xxxxxxxxxx&from=InfoMessage&dlr-url=http://exemple.com/dlr.php&content=hello !", "w");

curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);


 $ch = curl_init(' !');
 curl_exec ($ch);
 curl_close ($ch);

that I found here :

Sending POST form data with php CURL, api-http-examples-php and I tested all these examples without result, all show me 500 error.

Maybe it needs to configure .htaccess, my file permissions are 755 with www-data.

Thanks for any help.

marked as duplicate by Gerald Schneider, kubanczyk, Ward, Jenny D, Dave M Apr 27 '18 at 11:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    What is in your apache error.log ? 500 errors are internal server errors and indicate a problem with your script (typically) – ivanivan Apr 25 '18 at 12:25
  • I'v got these error : Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to undefined function curl_init() in /var/www/html/yip2.php:2\nStack trace:\n#0 {main}\n thrown in /var/www/html/yip2.php on line 2\n' for the second example. – hexphp111 Apr 25 '18 at 12:30
  • 1
    You need to add curl support to your PHP setup. How to do this will depend on what distro you are running... – ivanivan Apr 25 '18 at 12:39

There is no php-curl installed on your machine. You should install it. Installation depends on your OS.

More details about your error could be found in this answer.

  • Thank you, it's working after installing this: 'apt-get install php7.1-curl' , I must now make an input form from this : '<?php $ch = curl_init(""); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, "username=foo&password=bar&dlr=yes&dlr-level=3&to=xxxxxxxxxxfrom=InfoMessage&dlr-url=example.com/dlr.php&content=hello !); curl_exec($ch); curl_close($ch); ?>' - Any idea ? – hexphp111 Apr 26 '18 at 11:30
  • @hexphp111 just create form - here more docs. – Alexander Tolkachev Apr 26 '18 at 17:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.