anlutro / php-bulk-sms

BulkSMS API - PHP implementation
MIT License
36 stars 27 forks source link

BulkSMS API responded with HTTP status code 301 Moved Permanently #5

Closed Dmitri10 closed 7 years ago

Dmitri10 commented 8 years ago

Hello! using laravel 5.1 tried

$bulkSms = new BulkSmsService(config('bulk-sms.username'), config('bulk-sms.password'), config('bulk-sms.baseurl')); $bulkSms->sendMessage('full number without plus', 'Hello there!');

Then I tried $bulkSms = new BulkSmsService(config('bulk-sms.username'), config('bulk-sms.password'), config('bulk-sms.baseurl')); $bulkSms->setTestMode(BulkSmsService::TEST_ALWAYS_SUCCEED); $bulkSms->getStatusForBatchId(693099785);

The same result: BulkSmsException in BulkSmsService.php line 161: BulkSMS API responded with HTTP status code 301 Moved Permanently

What's the reason?

anlutro commented 8 years ago

I guess bulksms changed their URL structure. I'll have a look tonight.

anlutro commented 8 years ago

It's worse than I thought - bulksms seem to have removed their entire v1 API.

There are new versions of the API available (v2 and a new JSON API) which the library could be rewritten for, but I don't work with bulksms anymore and thus can't really justify spending time on doing this.

Dmitri10 commented 8 years ago

Understood... Thanks for response.

gawonmi commented 8 years ago

@anlutro

Can you please direct me to the updated api docs? I am still using this library in several projects and they all work fine. The JSON api is still in BETA afaik. There has been a mix of APIs for the HTTP endpoints (v1 and v2) for as long as I can remember.

anlutro commented 8 years ago

Oh, that's interesting. I just assumed v1 was removed because I could only find documentation referring to v2 here. That may have been a hasty conclusion... But what else could cause a 301, then?

gawonmi commented 8 years ago

Well...I guess it depends on the server Dimitri was connecting to. Bulksms uses country specific servers (that's why I removed the hardcoded dependency to a particular URL a while back). I am e.g. connecting to "bulksms.de" - Germany. There are also other servers like "bulksms.vsms.net". So, either it's a glitch or they are currently deploying the update server by server. I also find it highly unlikely that they would disable an API endpoint without sending a notification or posting a news article.

@Dmitri10 Can you provide some more information? Which server did you connect to?

Dmitri10 commented 8 years ago

@gawonmi Sorry for late response. I think I wrote down 'baseurl' => 'http://bulksms.com' After anlutro's response I took a php library from bulksms and that works...