This question already has an answer here:
- Reference - What does this error mean in PHP? 33 answers
I am a very beginner so forgive me if its too basic .
I have set a localhost using MAMP
and i have a index.php
file that call me via Twilio
, and its working great i get calls always:
<?php
$id = "ACxx15d26xxxxxxxxx454424bxxexx3f";
$token = "79fb4xxxf93c8exxxxxxxda6bxxxxe9 ";
$url = "https://api.twilio.com/2010-04-01/Accounts/$id/Calls.json";
$CallURL = "http://www.someweb.com";
$from = "+97223721333";
$to = "+971111111111"; // twilio trial verified number
$body = "Its all going to work!";
$data = array (
'From' => $from,
'To' => $to,
'Body' => $body,
'Url' => $CallURL,
);
$post = http_build_query($data);
$x = curl_init($url );
curl_setopt($x, CURLOPT_GET, true);
curl_setopt($x, CURLOPT_RETURNTRANSFER, true);
curl_setopt($x, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($x, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($x, CURLOPT_USERPWD, "$id:$token");
curl_setopt($x, CURLOPT_POSTFIELDS, $post);
$y = curl_exec($x);
curl_close($x);
var_dump($post);
var_dump($y);
?>
Then i have set an Amazon server EC2
, and i have put a few files in there (filezilla
) which worked also(i can load images in the browser-and it works).
Then i have tried to put this file in the server, well there are 2 things happened.
- when i put it as
index.php
, and browse there , i could see a blank page and nothing happened . when i put it as
index.html
and browse there , i have got this text ("which is not Json,so i dont know what it is) , and i didn't get the call also :$from, 'To' => $to, 'Body' => $body, ); $post = http_build_query($data); $x = curl_init($url ); curl_setopt($x, CURLOPT_POST, true); curl_setopt($x, CURLOPT_RETURNTRANSFER, true); curl_setopt($x, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($x, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($x, CURLOPT_USERPWD, "$id:$token"); curl_setopt($x, CURLOPT_POSTFIELDS, $post); $y = curl_exec($x); curl_close($x); var_dump($post); var_dump($y); */ //twillio call $id = "ACa015xx662d50dxxx454424b70xxxxxx"; $token = "79fb4b00efxxc8exxxf772da6bxxxxxx "; //only after : in the website $url = "https://api.twilio.com/2010-04-01/Accounts/$id/Calls.json"; $CallURL = "http://www.somewebsite.com"; $from = "+97223721333"; $to = "+ 971111111111"; // twilio trial verified number $body = "Its all going to work!"; $data = array ( 'From' => $from, 'To' => $to, 'Body' => $body, 'Url' => $CallURL, ); $post = http_build_query($data); $x = curl_init($url ); curl_setopt($x, CURLOPT_GET, true); curl_setopt($x, CURLOPT_RETURNTRANSFER, true); curl_setopt($x, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($x, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($x, CURLOPT_USERPWD, "$id:$token"); curl_setopt($x, CURLOPT_POSTFIELDS, $post); $y = curl_exec($x); curl_close($x); var_dump($post); var_dump($y); ?>
So , whats the different between putting it as .php and .html
? why is one of them is blank and the other has this respond ?
EDIT
I have tried to install curl with : sudo apt-get install php5-curl
(worked)
then i have tested to see if i have curl supported with this link: How to enable cURL extension on Amazon EC2 free tier result is that its not supported. Why is that ? i have installed it.