Hi,
I have a php file index.php that does a request to an add server as follows:
<?php
$BSMRT="75B1BE1F-C62B-2C35-3E48-D7B4D4FA5B97";
$ENDPOINT="http://www.addserver.net/ad_server/request";
$url="$ENDPOINT?adsiid=$BSMRT&mrkup=xhtml";
$adcode=file_get_contents($url);
?>
<?=$adcode ?>
This works on a normal server with php but the server this has to pass through has a "bot proxy". What I need to do is when the user clicks on the addserver image that it opens up in a new web page similar to onclick...
I must use <a href=" .... "></a> for the server to accept the code.
How do I put $adcode in the <a href syntax?
I've been trying this for days now and any help would be much appreciated.
Thanx in advance
href & php
Moderator: General Moderators
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: href & php
Code: Select all
<?php
$BSMRT="75B1BE1F-C62B-2C35-3E48-D7B4D4FA5B97";
$ENDPOINT="http://www.addserver.net/ad_server/request";
$url="$ENDPOINT?adsiid=$BSMRT&mrkup=xhtml";
$encodedURL = urlencode($url);
echo '<a href="' . $encodedURL . '">Link Name</a>';
?>
You may also have to use urlencode with file_get_contents.
HthThe manual wrote: If you're opening a URI with special characters, such as spaces, you need to encode the URI with urlencode().
EDIT
Changed the $adcode to $url
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Re: href & php
Thank you,
I will try this and get back...
I will try this and get back...
Re: href & php
This doesn't work. It places the whole url in the page instead of the image it is supposed to get from the server.
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: href & php
By image, what do you mean. image = picture?infrabyte wrote:...addserver image...
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering