Page 1 of 1

help curl_setopt( )

Posted: Tue Mar 11, 2014 11:48 am
by anuragaj
Hello there,

I need to post some parameters to a url using curl_setopt(), but I am having some problem.

The url is

Code: Select all

http://localhost:13013/XXXXX
right not I am using the below code

Code: Select all

<?php

//url without port number i.e http://localhost/xxxxx
//$field=xxx..
//$fields_string=xxxx….

$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POST_FIELDS,$fields_string);

$result=curl_ecec($ch);
curl_close($ch);

?>
the above will work fine but if I include port number in url it stops working.

like

Code: Select all

$url=http://localhost:13013/XXXX
I even tried adding

Code: Select all

curl_setopt($ch,CURLOPT_VERBOSE,0);
curl_setopt($ch,CURLOPT_PORT,13013);
//now url is just http://localhost/XXX
but still not working please help.

Re: help curl_setopt( )

Posted: Tue Mar 11, 2014 2:25 pm
by Christopher
What response do you get from the request that does not work?