myron Posted January 11, 2007 Share Posted January 11, 2007 I'm using a PHP/cURL script to upload a file from my server at GoDaddy to Shopzilla. It looks like it's working, but no file actually gets uploaded. I know my login name and password are correct because I can use them in FileZilla and they work fine;that's how I'm checking the upload to make sure it actually happened. Here's the code I'm using:[code]<?php$URL="ftp://username:[email protected]"; // ftp address to Shopzillaecho "Destination: ".$URL."<br>\n";$OutFile = "***server path here***/feeds/shopzilla.txt"; // path to file to uploadecho "Source: ".$OutFile."<br>\n";echo "Start cURL script...<br>\n";$ch = curl_init(); // start curl processecho "Open file...<br>\n";$fp = fopen ($OutFile, "r"); // open the file to readecho "Setting cURL options...<br>\n";// upload the filecurl_setopt($ch, CURLOPT_VERBOSE, 1); // to output verbose informationcurl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); // is default anyway...curl_setopt ($ch, CURLOPT_PROXY,"http://proxy.shr.secureserver.net:3128"); // GoDaddy's proxy servercurl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // to stop CURL from verifying the peer's certificatecurl_setopt($ch, CURLOPT_URL, $URL); // The URL to fetchcurl_setopt ($ch, CURLOPT_TIMEOUT, 360); // The maximum number of seconds to allow CURL functions to executecurl_setopt($ch, CURLOPT_UPLOAD, 1); // TRUE to prepare for an uploadcurl_setopt($ch, CURLOPT_INFILE, $fp); // The file that the transfer should be written to// set size of the file, which isn't _mandatory_ but helps libcurl to do// extra error checking on the upload.curl_setopt($ch, CURLOPT_INFILESIZE, filesize($OutFile));echo "Uploading file...<br>\n";echo "Check for errors...<br>\n";$error = curl_exec ($ch);// check $error here to see if it did fine or not!curl_close ($ch); echo "<br>Close cURL - process complete<br>\n";?>[/code]Here's the results:[quote]Destination: ftp://username:[email protected]Source: ***Server Path Here***/feeds/shopzilla.txtStart cURL script...Open file...Setting cURL options...Uploading file...Check for errors...--------------------------------------------------------------------------------Operation successfulFile createdGenerated Thu, 11 Jan 2007 23:38:50 GMT by wc04.inet.mesa1.secureserver.net (squid/2.5.STABLE12) --------------------------------------------------------------------------------Close cURL - process complete[/quote] Link to comment https://forums.phpfreaks.com/topic/33831-curl-ftp-wont-upload/ Share on other sites More sharing options...
fert Posted January 12, 2007 Share Posted January 12, 2007 why don't you use the FTP functions? Link to comment https://forums.phpfreaks.com/topic/33831-curl-ftp-wont-upload/#findComment-158748 Share on other sites More sharing options...
myron Posted January 12, 2007 Author Share Posted January 12, 2007 Because GoDaddy doesn't support them. They want me to use cURL instead. Link to comment https://forums.phpfreaks.com/topic/33831-curl-ftp-wont-upload/#findComment-158751 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.