php - Want to execute url with Port number

480

Dear all please help me how can i execute following url using cURL using php?

https://telenorcsms.com.pk:27677/corporate_sms2/api/auth.jsp?msisdn=923468211085&password=Javed1212

i am tring this but no result found.

$tuCurl = curl_init(); 
curl_setopt($tuCurl, CURLOPT_URL, "https://telenorcsms.com.pk/corporate_sms2/api/auth.jsp?msisdn=923468211085&password=Javed1212"); 
curl_setopt($tuCurl, CURLOPT_PORT , 27677); 
curl_setopt($tuCurl, CURLOPT_VERBOSE, 0); 
curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($tuCurl, CURLOPT_CONNECTTIMEOUT, 5); // 5 seconds timeout

$tuData = curl_exec($tuCurl); 
curl_close($tuCurl);

echo $tuData;
275

Answer

Solution:

It seems that your request is at the "middle" of authentication process.
Perhaps, you need to consider some credentials over the request to access the needed resource.
At first, setCURLOPT_VERBOSE in active mode :true(1) (to obtain the details of the request processing).
Secondly, that site returns anXML response back.
Usevar_dump to get more details about response.
Here is how it looks now:

$tuCurl = curl_init(); 
curl_setopt($tuCurl, CURLOPT_URL, "https://telenorcsms.com.pk/corporate_sms2/api/auth.jsp?msisdn=923468211085&password=Javed1212"); 
curl_setopt($tuCurl, CURLOPT_PORT , 27677); 
curl_setopt($tuCurl, CURLOPT_VERBOSE, true); 
curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($tuCurl, CURLOPT_CONNECTTIMEOUT, 5); // 5 seconds timeout

$tuData = curl_exec($tuCurl); 
curl_close($tuCurl);

var_dump($tuData);

The output:

'<?xml version="1.0" encoding="UTF-8" ?>








  <corpsms>
    <command>Auth_request</command>
    <data>8c22d08be9bd492ea06bef31af4d62f3</data>
    <response>OK</response>
  </corpsms >

'

People are also looking for solutions to the problem: PHP post facebook page statuses

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.