How to convert a url to a browser like url? ( ...%20... )

Posted by Kaoukkos on Stack Overflow See other posts from Stack Overflow or by Kaoukkos
Published on 2012-03-22T17:21:06Z Indexed on 2012/03/22 17:31 UTC
Read the original article Hit count: 191

Filed under:
|

I want to get data using CURL but I have a problem. When I set the url like this

$url = "https://graph.facebook.com/fql?q=SELECT name FROM page"; // continues

I do not have anything returned. When I copy the browser url, this is

$url = "https://graph.facebook.com/fql?q=SELECT%20name%20FROM%20page";

I get the results through CURL. I tried htmlentities and htmlspecialchars without luck.

What am I missing here?

  $ch = curl_init($url);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  $content = curl_exec($ch);

© Stack Overflow or respective owner

Related posts about php

Related posts about curl