diff --git a/src/Symfony/Component/Notifier/Bridge/FreeMobile/FreeMobileTransport.php b/src/Symfony/Component/Notifier/Bridge/FreeMobile/FreeMobileTransport.php index 936e6b3a16ca3..bbb98dbab92d2 100644 --- a/src/Symfony/Component/Notifier/Bridge/FreeMobile/FreeMobileTransport.php +++ b/src/Symfony/Component/Notifier/Bridge/FreeMobile/FreeMobileTransport.php @@ -26,7 +26,7 @@ */ final class FreeMobileTransport extends AbstractTransport { - protected const HOST = 'https://smsapi.free-mobile.fr/sendmsg'; + protected const HOST = 'smsapi.free-mobile.fr/sendmsg'; private $login; private $password; @@ -57,7 +57,9 @@ protected function doSend(MessageInterface $message): void throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given) and configured with your phone number.', __CLASS__, SmsMessage::class, \get_class($message))); } - $response = $this->client->request('POST', $this->getEndpoint(), [ + $endpoint = sprintf('https://%s', $this->getEndpoint()); + + $response = $this->client->request('POST', $endpoint, [ 'json' => [ 'user' => $this->login, 'pass' => $this->password, diff --git a/src/Symfony/Component/Notifier/Bridge/FreeMobile/FreeMobileTransportFactory.php b/src/Symfony/Component/Notifier/Bridge/FreeMobile/FreeMobileTransportFactory.php index aab7925d3967a..2a85414887eb1 100644 --- a/src/Symfony/Component/Notifier/Bridge/FreeMobile/FreeMobileTransportFactory.php +++ b/src/Symfony/Component/Notifier/Bridge/FreeMobile/FreeMobileTransportFactory.php @@ -43,7 +43,10 @@ public function create(Dsn $dsn): TransportInterface throw new IncompleteDsnException('Missing phone.', $dsn->getOriginalDsn()); } - return new FreeMobileTransport($login, $password, $phone, $this->client, $this->dispatcher); + $host = 'default' === $dsn->getHost() ? null : $dsn->getHost(); + $port = $dsn->getPort(); + + return (new FreeMobileTransport($login, $password, $phone, $this->client, $this->dispatcher))->setHost($host)->setPort($port); } protected function getSupportedSchemes(): array diff --git a/src/Symfony/Component/Notifier/Bridge/FreeMobile/Tests/FreeMobileTransportFactoryTest.php b/src/Symfony/Component/Notifier/Bridge/FreeMobile/Tests/FreeMobileTransportFactoryTest.php index 082994b3744a3..9f12505de103e 100644 --- a/src/Symfony/Component/Notifier/Bridge/FreeMobile/Tests/FreeMobileTransportFactoryTest.php +++ b/src/Symfony/Component/Notifier/Bridge/FreeMobile/Tests/FreeMobileTransportFactoryTest.php @@ -23,9 +23,7 @@ public function testCreateWithDsn() { $factory = $this->createFactory(); - $dsn = 'freemobile://login:pass@default?phone=0611223344'; - $transport = $factory->create(Dsn::fromString($dsn)); - $transport->setHost('host.test'); + $transport = $factory->create(Dsn::fromString('freemobile://login:pass@host.test?phone=0611223344')); $this->assertSame('freemobile://host.test?phone=0611223344', (string) $transport); }
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: