0

I want to transfer some data in a variable between two sites using PHP. In my Javascript, When a button clicks, it goes to a php file that saves an image and then i want to redirect to other site and sending it the image name. I have image name in a variable and I want to send it.

So how can i do that securely in PHP?

MJQ
  • 1,778
  • 6
  • 34
  • 60

2 Answers2

0

There's lots of ways you could do something like this.

  • Your first PHP app could connect to the second site itself, over SSL and using additional encryption if you think that's necessary, and send the path to the image. The second PHP app could then decrypt and store the image path.
  • You could encrypt the image path and use it in the redirect to the second site as part of a querystring. The second site could then decrypt it.
  • The first PHP app could store the image path in a database table shared by both sites - the second site then reads the path out.

Are both the sites on the same server? Do they share a database? Why are you concerned about security - do you want the user not to know the image path or is it other people snooping you're worried about?

James
  • 13,092
  • 1
  • 17
  • 19
  • I just want that the data will not be visible to the user! – MJQ Sep 20 '12 at 10:45
  • i.e. if i send it like http://otherwebsite.com/foo?img_path=pathtoimage It will be visible. I don't want that! – MJQ Sep 20 '12 at 10:45
  • I understand - so do the communication on the server side, as per my first two suggestions. – James Sep 20 '12 at 10:46
0

Send a HTTP redirect in PHP and pass the image name in a get variable using

header("Location: http://otherwebsite.com/foo?img_path=pathtoimage");

jb11
  • 557
  • 5
  • 18