Reputation: 21081
Facebook image url for user profile looks like
https://scontent.xx.fbcdn.net/hprofile-xfa1/v/t1.0-1/c26.26.321.321/s50x50/1004031_160695494109373_202362495_n.jpg?oh=bc24275f3c0b63adcd7f2
I want to send this url in request to server
$FBImageUrl = "https://scontent.xx.fbcdn.net/hprofile-xfa1/v/t1.0-1/c26.26.321.321/s50x50/1004031_160695494109373_202362495_n.jpg?oh=bc24275f3c0b63adcd7f2";
$postString = "http://example.com/script.php?img_url=" . FBImageUrl;
But what will happen if this url have question mark inside?
Upvotes: 0
Views: 141
Reputation: 344
You can use base64_encode
& base64_decode
. Also for security reasons image URL wont be visible in the address bar.
$FBImageUrl = "https://scontent.xx.fbcdn.net/hprofile-xfa1/v/t1.0-1/c26.26.321.321/s50x50/1004031_160695494109373_202362495_n.jpg?oh=bc24275f3c0b63adcd7f2";
$base64Url = base64_encode($FBImageUrl);
$postString = "http://example.com/script.php?img_url=" . $base64Url;
Receiver you can decode it
$fbUrl = base64_decode($_GET['img_url']);
Upvotes: 0
Reputation: 2995
use urlencode()
$FBImageUrl = "https://scontent.xx.fbcdn.net/hprofile-xfa1/v/t1.0-1/c26.26.321.321/s50x50/1004031_160695494109373_202362495_n.jpg?oh=bc24275f3c0b63adcd7f2";
$postString = "http://example.com/script.php?img_url=".urlencode($FBImageUrl) ;
In your script.php
$img_url = urldecode($_GET['img_url']);
Upvotes: 3