Help - Search - Members - Calendar
Full Version: Assign value to a variable from url
HTMLHelp Forums > Programming > Server-side Scripting
rrn
hi ,

CODE
$graph = "http://www.abc.com/ss";


is the above shown code correct ?
i want to take the value from the url and assign it to $graph.
is it the right way to do it??

pls give a solution.

thank you.
Brian Chandler
This assigns the _string_ http://www.abc.com/ss to the variable.

What do you mean by "the value from the url"? What is "the value from" this URL for example:

http://imaginatorium.org/shop

rrn
QUOTE(Brian Chandler @ Apr 23 2009, 02:58 AM) *

This assigns the _string_ http://www.abc.com/ss to the variable.

What do you mean by "the value from the url"? What is "the value from" this URL for example:

http://imaginatorium.org/shop



in the url "www.abc.com/ss.html" , there is an image in that page .

i want to assign that image to $graph.
Brian Chandler
QUOTE
i want to assign that image to $graph.


In order to do what? You can read an image from a remote URL (if you have the urlopen option enabled), using the gd library. The variable will then hold a handle for the image. You need to read the php manual:

http://jp2.php.net/manual/en/book.image.php

But please explain what you are actually trying to do. If I find your explanation unpersuasive (i.e. it looks as though you are just trying to rip off someone else's work), there will no doubt be no technical obstacle, but I probably won't bother to help.
rrn
QUOTE(Brian Chandler @ Apr 23 2009, 04:17 AM) *

QUOTE
i want to assign that image to $graph.


In order to do what? You can read an image from a remote URL (if you have the urlopen option enabled), using the gd library. The variable will then hold a handle for the image. You need to read the php manual:

http://jp2.php.net/manual/en/book.image.php

But please explain what you are actually trying to do. If I find your explanation unpersuasive (i.e. it looks as though you are just trying to rip off someone else's work), there will no doubt be no technical obstacle, but I probably won't bother to help.


i am not trying to rip off somebody else's work.
in my website , there is an online graph. that graph is taken from some other site.. thats what i am trying to do..
got it ?

thanks
Brian Chandler
QUOTE(rrn @ Apr 23 2009, 07:39 PM) *

QUOTE(Brian Chandler @ Apr 23 2009, 04:17 AM) *

QUOTE
i want to assign that image to $graph.


In order to do what? You can read an image from a remote URL (if you have the urlopen option enabled), using the gd library. The variable will then hold a handle for the image. You need to read the php manual:

http://jp2.php.net/manual/en/book.image.php

But please explain what you are actually trying to do. If I find your explanation unpersuasive (i.e. it looks as though you are just trying to rip off someone else's work), there will no doubt be no technical obstacle, but I probably won't bother to help.


i am not trying to rip off somebody else's work.
in my website , there is an online graph. that graph is taken from some other site.. thats what i am trying to do..
got it ?

thanks


Oh, right, we've been here before. Well, you do need to explain why you can't simply write

<img src="http://somewherelse.zz/public_graphs/hayfever.png">

in your web page? Sometimes there is a reason -- on the address I gave you before there's also a graph that comes from somewhere else:

http://imaginatorium.org/shop/shop.htm -- where it says "10% discount on all orders".

I made the graph with the Google charts API (which is *excellent*, btw), and I could simply put the Google url in the web page, but:

1. The Google URL is *ridiculously* long, since it includes all the data
2. I only update the chart about once a month, so it seems a waste of googlepower to keep generating it.

So I just copy the file to my server, using copy() http://jp2.php.net/manual/en/function.copy.php

But anyway, please explain your reasons for needing to make a separate copy...
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.