Huge url in curl request
i have to send parameters with get to a url.
It's an sms gateway and i have to pass sms info.
$url = 'http://host:port/send?user=user&from=from&to=to1+to2+to3+........+to1000+text=smstext';
where to1,to2...to1000 are receivers phone numbers.
So, i use curl to make the job.
The problem is that due to big length of my parameters when i have many receivers, the url i call is huge an i get error for exceeding max url length.
I could split receivers to smaller batches and call a curl for each batch, but 开发者_StackOverflow社区i don't think it's the best solution.
Furthermore, so big url makes me feel that something is beeing done not as properly as it could.
Do you have an idea on it?
P.S: Using post instead of get is not an option.
P.S: Using post instead of get is not an option.
If the call fails because the URL is too long, using POST is indeed the only option there is.
Alternatively, as you say, you will have to split the whole thing into multiple calls.
This sounds like a design error on the gateway's part, though. Are you 100% sure they don't support POST requests? That would be the cleanest way to go about this.
精彩评论