help curl_setopt( )

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
anuragaj
Forum Newbie
Posts: 1
Joined: Tue Mar 11, 2014 11:39 am

help curl_setopt( )

Post 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.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: help curl_setopt( )

Post by Christopher »

What response do you get from the request that does not work?
(#10850)
Post Reply