-
Notifications
You must be signed in to change notification settings - Fork 5
SOLAPI PHP SDK 5.1.2 #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| <?php | ||
|
|
||
| require_once dirname(__DIR__) . '/vendor/autoload.php'; | ||
|
|
||
| use GuzzleHttp\Client; | ||
| use Nurigo\Solapi\Exceptions\MessageNotReceivedException; | ||
| use Nurigo\Solapi\Models\Message; | ||
| use Nurigo\Solapi\Services\SolapiMessageService; | ||
|
|
||
| /** | ||
| * 커스텀 PSR-18 HTTP 클라이언트를 이용한 SMS 발송 예제 | ||
| * | ||
| * SolapiMessageService 생성자의 3번째 인자로 PSR-18(Psr\Http\Client\ClientInterface) 호환 HTTP 클라이언트를 주입할 수 있습니다. | ||
| * 이 예제에서는 Guzzle HTTP 클라이언트를 사용합니다. | ||
| * | ||
| * 사전 설치가 필요합니다: | ||
| * composer require guzzlehttp/guzzle | ||
| * | ||
| * Guzzle 외에도 PSR-18을 구현한 다른 HTTP 클라이언트를 사용할 수 있습니다: | ||
| * - Symfony HttpClient (symfony/http-client + symfony/psr-http-message-bridge) | ||
| * - PHP-HTTP Curl Client (php-http/curl-client) | ||
| */ | ||
| try { | ||
| // Guzzle 클라이언트 생성 (필요에 따라 옵션을 설정할 수 있습니다) | ||
| $httpClient = new Client([ | ||
| 'timeout' => 10, | ||
| 'connect_timeout' => 5, | ||
| // 'proxy' => 'http://proxy.example.com:8080', | ||
| // 'verify' => '/path/to/cacert.pem', | ||
| ]); | ||
|
|
||
| // SolapiMessageService 생성 시 3번째 인자로 커스텀 HTTP 클라이언트를 전달합니다 | ||
| $messageService = new SolapiMessageService("ENTER_YOUR_API_KEY", "ENTER_YOUR_API_SECRET", $httpClient); | ||
|
|
||
| $message = new Message(); | ||
| $message->setTo("수신번호") | ||
| ->setFrom("계정에서 등록한 발신번호 입력") | ||
| ->setText("한글 45자, 영자 90자 이하 입력되면 자동으로 SMS타입의 메시지가 발송됩니다."); | ||
|
|
||
| $result = $messageService->send($message); | ||
| print_r($result); | ||
| } catch (MessageNotReceivedException $exception) { | ||
| print_r($exception->getFailedMessageList()); | ||
| print_r("----"); | ||
| print_r($exception->getMessage()); | ||
| } catch (Exception $exception) { | ||
| print_r($exception->getMessage()); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.