I'm using the YouTube API and they require a user to send an HTTP post with the 'data' of a video (title, description, etc) in XML format. I find the size of my xml using
length($xmldata);
and it returns me the correct number of bytes.
However, when I set up my headers for my post and include this content-length, it seems as if the content-length value is too high because I get the following when I run the script from the command line:
% Total % Received % Xferd Average Speed Time Time Time
+ Current Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:42 --:--:
+-- 0
...it's as if it is waiting for more data from me.
I tinkered with the content-length and found a good value where the post was accepted and went through perfectly, but I need my program to figure out this value.
Any suggestions on how content-length works in http headers and how I can get the correct value to send? I also tried opening/writing/closing a file and then doing a filesize on the file, but it's the same value as the perl 'length' function.
Thank you
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.