2017-10-18 4 views
0

Ich habe ein Problem, wenn ich eine GET-Anfrage mit PHP Curl oder File_get_contents Funktion senden möchte !!! Ich denke, dieses Problem ist für meine URL !!! mir bitte helfen ... meinen Code (file_get_contents Funktion):So senden Sie GET-Anfrage mit PHP-Curl

$SMStext = "text"; 
$SMSmobile = 'phonenumber'; 
$SMSurl = "http://api.payamak-panel.com/post/sendsms.ashx?username=username&password=pass&from=smsnumber&to="; 
$SMSurl .= $SMSmobile; 
$SMSurl .= '&text='; 
$SMSurl .= $SMStext; 

echo file_get_contents($SMSurl); 

meinen Code (php curl):

$SMStext = "text"; 
$SMSmobile = 'phonenumber'; 
$SMSurl = "http://api.payamak-panel.com/post/sendsms.ashx?username=username&password=pass&from=smsnumber&to="; 
$SMSurl .= $SMSmobile; 
$SMSurl .= '&text='; 
$SMSurl .= $SMStext; 
$ch = curl_init(); 

curl_setopt($ch,CURLOPT_URL,$SMSurl); 
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); 
// curl_setopt($ch,CURLOPT_HEADER, false); 

$output=curl_exec($ch); 

curl_close($ch); 
echo $output 
+3

Mögliche Duplikat [PHP cURL GET Anfrage und Wunsch des Körpers] (https://stackoverflow.com/questions/17230246/php-curl-get-request-and-requests-body) –

Antwort

0

Diese URL leitet auf eine andere URL.
Sie müssen hinzufügen: curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);