Alexis
Alexis

Reputation: 1

How to remove unwanted characters

I am using cakephp 1.2. I am using httpsocket get method. It works well. But the content is enclosed by quotes..

string(123) "..this is where the content is".

I think it is telling the type of response and the number of characters of the output. I have my application in production setup.

How can i remove it.

I appreciate any help.

Thanks.

Upvotes: 0

Views: 197

Answers (1)

Jim
Jim

Reputation: 18863

It sounds like a var_dump is being done on the other end.

Either or, this should pull out the text.

preg_match('~"(.*)"~s', $string, $matches);

if (!empty($matches)) {
    $returned  = $matches[1];
}

echo $returned; 

Hopefully my regex isn't horrible.

Upvotes: 1

Related Questions