The ProgrammersTalk Community
Forum Register Search Today's Posts Mark Forums Read
Register

Go Back   The ProgrammersTalk Community > Web Programming > PHP


Welcome to the The ProgrammersTalk Community forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Closed Thread
 
LinkBack Thread Tools    Display Modes   
  #1 (permalink)  
Old 08-03-2007, 04:50 PM
TeraTask's Avatar
TeraTask TeraTask is offline
PT Staff*
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 3
Join Date: Jun 2007
Location: Reno, NV
Posts: 416
iTrader: (0)
TeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enough
[SOLVED] cURL Error #18?

OK. Here's one: I have the following code:
PHP Code:
<?php
$content 
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><methodCall><methodName>metaWeblog.getCategories</methodName><params><param><value><string>1</string></value></param><param><value><string>{USERNAME}</string></value></param><param><value><string>{PASSWORD}</string></value></param></params></methodCall>";

$ch curl_init();
curl_setopt($chCURLOPT_POST,1);
curl_setopt($chCURLOPT_POSTFIELDSIZEstrlen($content));
curl_setopt($chCURLOPT_POSTFIELDS,$content);
curl_setopt($chCURLOPT_URL,'{URL}');
curl_setopt($chCURLOPT_SSL_VERIFYPEER0); // Don't stress about SSL validity
curl_setopt($chCURLOPT_RETURNTRANSFER,1);

$headers[] = "Authorization: BASIC ".base64_encode('{USERNAME}:{PASSWORD}');
$headers[] = 'Content-type: application/xml';
curl_setopt($chCURLOPT_HTTPHEADER$headers);
$result=curl_exec ($ch);
$curl_error curl_error($ch);
$curl_error_no curl_errno($ch);

if (
$curl_error_no 0) {
  
$curl_error curl_error($ch);
  
$curl_error_no curl_errno($ch);
  echo 
"cURL Error: (".$curl_error_no.") ".$curl_error;
} else {
  echo 
"Successfully retrieved: ".$result;
}
curl_close ($ch);
?>
Which works on most servers just fine to fetch the XML returned by WordPress for a category listing. On one server, though, I get this message:

cURL Error: (18) transfer closed with 1372 bytes remaining to read

I have searched and searched ( curl "transfer closed with" "bytes remaining to read" - Google Search ) and read and read and cannot find a hint as to what the hell is happening. Does anyone have a clue on this? If so, can you clue me in?

Thanks a ton in advance!!!!!

NOTE: You'd need to change {USERNAME}, {PASSWORD}, and {URL} to the appropriate values for testing. Due to confidentiality, I cannot release the URL where this is failing, but I can get server info if necessary.

__________________
Jeremy Miller
Content Farmer - Optimized Automated Blog Posting

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
  #2 (permalink)  
Old 08-03-2007, 05:55 PM
rpgfan3233 rpgfan3233 is offline
PT Staff
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jul 2007
Posts: 118
iTrader: (0)
rpgfan3233 has a spectacular aura aboutrpgfan3233 has a spectacular aura aboutrpgfan3233 has a spectacular aura aboutrpgfan3233 has a spectacular aura aboutrpgfan3233 has a spectacular aura about
Perhaps the server config might help. Also, do you know WHERE it is failing? That might help too.

__________________
"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off."
-- Bjarne Stroustrup, creator of what is now known as C++
For more quotes by Bjarne Stroustrup, check out http://www.research.att.com/~bs/bs_faq.html#really-say-that.
Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
The Following User Says Thank You to rpgfan3233 For This Useful Post:
TeraTask (08-04-2007)
  #3 (permalink)  
Old 08-03-2007, 06:03 PM
TeraTask's Avatar
TeraTask TeraTask is offline
PT Staff*
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 3
Join Date: Jun 2007
Location: Reno, NV
Posts: 416
iTrader: (0)
TeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enough
What part of the server config? I don't have full access. I could get phpinfo(), but since I'd have to edit it to make it confidential, specific info needed would be helpful.

It's failing during the return. From what I was able to find out, the server is indicating that so many bytes of data will be sent but is not sending them all. cURL expects it to match and craps out with that message when they don't. I'm not sure how, or even if, that can be fixed.

__________________
Jeremy Miller
Content Farmer - Optimized Automated Blog Posting

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
  #4 (permalink)  
Old 08-04-2007, 02:38 AM
TeraTask's Avatar
TeraTask TeraTask is offline
PT Staff*
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 3
Join Date: Jun 2007
Location: Reno, NV
Posts: 416
iTrader: (0)
TeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enough
OK... I got a bit frustrated and just coded a script to connect directly to the server. I sent

Code:
POST /xmlrpc.php HTTP/1.0
Host: mydomain.com
Content-Type: text/xml
Content-length: 288

<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>metaWeblog.getCategories</methodName><params><param><value><string>1</string></value></param><param><value><string>{USERNAME}</string></value></param><param><value><string>{PASSWORD}</string></value></param></params></methodCall>
and received
Code:

HTTP/1.1 200 OK
Date: Sat, 04 Aug 2007 09:30:11 GMT
Server: Apache/1.3.37 (Unix) PHP/5.2.3 mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a
X-Powered-By: PHP/5.2.3
Connection: close
Content-Length: 1372
Content-Type: text/xml
No, I'm not missing the part after the Content-Type; the server is just not sending it. How is that even possible?

__________________
Jeremy Miller
Content Farmer - Optimized Automated Blog Posting

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
  #5 (permalink)  
Old 08-04-2007, 11:02 AM
TeraTask's Avatar
TeraTask TeraTask is offline
PT Staff*
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 3
Join Date: Jun 2007
Location: Reno, NV
Posts: 416
iTrader: (0)
TeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enough
This has been in relation to WordPress. I got an idea last night just before crawling into bed to test this with a clean install of WP (no plugins or anything). A clean install worked just fine, so the client is adding the plugins back in one-at-a-time to see which caused it. I'll report back here when I have more.

__________________
Jeremy Miller
Content Farmer - Optimized Automated Blog Posting

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
  #6 (permalink)  
Old 08-08-2007, 09:24 AM
TeraTask's Avatar
TeraTask TeraTask is offline
PT Staff*
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 3
Join Date: Jun 2007
Location: Reno, NV
Posts: 416
iTrader: (0)
TeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enough
Apparently it was none of the client's plugins - it was just a corrupted install of WordPress. I hope this helps someone in the future!

__________________
Jeremy Miller
Content Farmer - Optimized Automated Blog Posting

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Closed Thread


Thread Tools
Display Modes

   Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 04:45 PM. Powered by vBulletin
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO © 2007 ProgrammersTalk Sedo - Buy and Sell Domain Names and Websites project info: programmerstalk.net Statistics for project programmerstalk.net etracker® web controlling instead of log file analysis


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50