note 104258 rejected from function.curl-setopt by danbrown

From: Date: Sat, 04 Jun 2011 17:21:18 +0000
Subject: note 104258 rejected from function.curl-setopt by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-180251@lists.php.net to get a copy of this message
Note Submitter: anjith dot garapati at softima dot com ---- Hi, I am doing ftp using curl until today, cilent want to keep a router in before server so that all requests to server should go through it. The router is configured so that eveery ftp request will be redirected to 21 port of the server through team viewer i have installed ftp server on port 21. But using curl program i previously used i am unable to do ftp with server. Below is the code i used before and after router is placed. Old code:- <?php $url="SEVER IP"; $user_pwd ="username:password" ; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERPWD, $user_pwd); $putData = tmpfile(); fwrite($putData, $strData); fseek($putData, 0); curl_setopt($ch, CURLOPT_PUT, true); curl_setopt($ch, CURLOPT_INFILE, $putData); curl_setopt($ch, CURLOPT_INFILESIZE, strlen($strData)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $strContent = curl_exec($ch); $err = curl_errno($ch); fclose($putData); curl_close($ch); ?> New code i have changed only url to router ip and appened port number and kept few options true <?php $url="router_ip:port_number"; $user_pwd ="username:password" ; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE); curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE); curl_setopt($ch, CURLOPT_USERPWD, $user_pwd); $putData = tmpfile(); fwrite($putData, $strData); fseek($putData, 0); curl_setopt($ch, CURLOPT_PUT, true); curl_setopt($ch, CURLOPT_INFILE, $putData); curl_setopt($ch, CURLOPT_INFILESIZE, strlen($strData)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $strContent = curl_exec($ch); $err = curl_errno($ch); fclose($putData); curl_close($ch); ?> Did i need to do anything more or it is problem with router and ftp server installed on server

« previous php.notes (#180251) next »