cURL, str_replace and textarea

Discussion in 'PHP' started by chachko, Apr 25, 2009.

  1. #1
    Hello there,

    I am having a headachingly but a relatively simple problem which i cannot solve. I am using cURL to gather html code from a given URL.

    In one window, I am placing the code in a textarea and after submitting the form with the textarea in it (without making any changes) I put the code into a file.

    In another window, I am cURL'ing the data straight to the file.

    Though, the amount of characters is different.
    Through textarea: 103,055
    Without textarea: 100,825

    How can this be? I've tried str_replace function to remove \n or \r or \t characters or trim() the second file, but it resulted, of course, in even less characters.

    The problem is, the system is much more difficult than this, but this part is not changed. I need the second file (without textarea) to be exactly, byte to byte, the same as the first one, without using textarea. How can I achieve this?

    Thank you in advance.

    forgot to mention that I am using $html = htmlentities($htmlcode, ENT_QUOTES, 'UTF-8', true); and I am displaying the $html variable in the textarea. But after the form has been submitted, I check the code and it is decoded, but maybe textarea displays the code somewhat different than it would be just cURL'ing. And then after submission the character count gets different or something. I don't really know.
     
    chachko, Apr 25, 2009 IP
  2. mfscripts

    mfscripts Banned

    Messages:
    319
    Likes Received:
    4
    Best Answers:
    8
    Trophy Points:
    90
    Digital Goods:
    3
    #2
    I'd check your characters for escaping i.e. \" then use a diff viewer to compare the 2 strings.
     
    mfscripts, Apr 26, 2009 IP