Using following method i can login to API:
$ curl -v "http://www.test.com/a/b/c?id=1234" -u user1 -LK -XGET; But, In PHP how can i submit username/password which is asked by htpasswd popup?
public static function sendSMS($from, $to, $username, $password, $text) { $text = rawurlencode($text); $uri = "https://www.voipbuster.com/myaccount/sendsms.php?username={$username}&password={$password}&from={$from}&to={$to}&text={$text}"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $uri); //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true ); //curl_setopt($ch, CURLOPT_TIMEOUT, '3'); //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //curl_setopt($ch, CURLOPT_POST, false); // //curl_setopt($ch, CURLOPT_POSTFIELDS, $postString); //curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); $result = curl_exec($ch); curl_close($ch); }