myron
-
Posts
6 -
Joined
-
Last visited
Never
Posts posted by myron
-
-
I have a function:
function splitPageResults($query, $max_rows, $count_key = '*', $page_holder = 'page')
I want to pass values for the first, second, and last arguments, but I want to use the default value for the third argument. How do I do that?
-
Because GoDaddy doesn't support them. They want me to use cURL instead.
-
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:password.@ftp.shopzilla.com"; // ftp address to Shopzilla
echo "Destination: ".$URL."<br>\n";
$OutFile = "***server path here***/feeds/shopzilla.txt"; // path to file to upload
echo "Source: ".$OutFile."<br>\n";
echo "Start cURL script...<br>\n";
$ch = curl_init(); // start curl process
echo "Open file...<br>\n";
$fp = fopen ($OutFile, "r"); // open the file to read
echo "Setting cURL options...<br>\n";
// upload the file
curl_setopt($ch, CURLOPT_VERBOSE, 1); // to output verbose information
curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); // is default anyway...
curl_setopt ($ch, CURLOPT_PROXY,"http://proxy.shr.secureserver.net:3128"); // GoDaddy's proxy server
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // to stop CURL from verifying the peer's certificate
curl_setopt($ch, CURLOPT_URL, $URL); // The URL to fetch
curl_setopt ($ch, CURLOPT_TIMEOUT, 360); // The maximum number of seconds to allow CURL functions to execute
curl_setopt($ch, CURLOPT_UPLOAD, 1); // TRUE to prepare for an upload
curl_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:password@ftp.shopzilla.com
Source: ***Server Path Here***/feeds/shopzilla.txt
Start cURL script...
Open file...
Setting cURL options...
Uploading file...
Check for errors...
--------------------------------------------------------------------------------
Operation successful
File created
Generated Thu, 11 Jan 2007 23:38:50 GMT by wc04.inet.mesa1.secureserver.net (squid/2.5.STABLE12)
--------------------------------------------------------------------------------
Close cURL - process complete[/quote] -
Did you ever find a solution to your ftp_connect problem? If so, what was it? I'm having the same problem.
Myron -
Alberto,
I'm having the exact same problem. Did you find a solution?
Myron
Functions: optional arguments
in PHP Coding Help
Posted
Thanks to everyone who replied. I'll try some of your suggestions.