NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP HTTP POST not working

Tom Melendez tom at supertom.com
Thu Jan 17 11:43:46 EST 2008


So what is in $result?

Anything in your error log?

Tom
http://www.liphp.org


On Jan 16, 2008 8:48 PM, Jason Sia <jsia18 at yahoo.com> wrote:
>
> I am transferring to a new server, my code in php using curl with http post
> works very well.  However, when I transferred the file to the new server it
> does not work anymore.  I tried if php curl is working by simply accessing a
> webpage and displaying its contents but with no http post, it works fine and
> it displays the webpage however if I tried adding a http post it does not
> work anymore.  I've checked the phpinfo() and here is the output:
>
> CURL support enabled
> CURL Information libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Here is the sample source code:
>
>         $url = 'http://www.example.com';
>         $csv= 'username=user&password=password';
>
>         $ch = curl_init();
>
>         curl_setopt($ch, CURLOPT_URL, $url);
>
>         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
>
>         curl_setopt($ch, CURLOPT_HEADER, 0);
>
>         curl_setopt($ch, CURLOPT_POST, 1);
>
>         curl_setopt($ch, CURLOPT_POSTFIELDS, $csv);
>
>         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
>
>         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
>
>         $result=curl_exec ($ch);
>         curl_close ($ch);
>
>
>
> I use the same file in my old server and until now its working fine there
> but in my new server it does not work anymore.  Does this need any
> additional configuration in my httpd.conf or php.ini?
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>



More information about the talk mailing list