NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP HTTP POST not working

Jason Sia jsia18 at yahoo.com
Wed Jan 16 23:48:20 EST 2008


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 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20080116/80d84520/attachment.html>


More information about the talk mailing list