Current location: Hot Scripts Forums » Programming Languages » PHP » get URL from iframe in PHP?


get URL from iframe in PHP?

Reply
  #1 (permalink)  
Old 01-14-05, 01:07 AM
nassau nassau is offline
Wannabe Coder
 
Join Date: May 2004
Posts: 211
Thanks: 0
Thanked 0 Times in 0 Posts
get URL from iframe in PHP?

i have an external iframe on my website and i want PHP to read the URL from that iframe and pass it on to my own form, in my own index.php file.

possible?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 01-14-05, 05:36 AM
Beck Beck is offline
Newbie Coder
 
Join Date: Jan 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
of course you can do it...

firstly u have to open it with fopen and put all content of that page into a variable...

and u should use some regexp to parse(html and other unnecessary parts) it.... eventually u're gonna get info which u had wanted...

there is an example which i used 2 years ago...

<?PHP
$euro = fopen("http://www.eurosport.com/home/pages/V3/L0/S22/E5123/standingCh_Lng0_Spo22_Evt5123_Grp30.shtml","r");

$yaz = false;
$cnt = 0;

while(!feof($euro))
{
$cnt++;
if(($cnt>146) && ($cnt<164)){
$yaz = true;
}
else
{
$yaz = false;
}

$line = fgets($euro, 512);
$line = trim($line);
$line = strip_tags($line, '<head>');

if(($line != "") && ($yaz == true)){
$pos = strpos($line, ">");
$sonuc = substr($line,$pos,"50");
echo $sonuc;
echo "<hr color=\"orange\">";
}
}

?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 01-14-05, 11:23 AM
nassau nassau is offline
Wannabe Coder
 
Join Date: May 2004
Posts: 211
Thanks: 0
Thanked 0 Times in 0 Posts
thanks for your reply. i'm pretty new with php so if you don't mind, would you like to walk me throught it just a little.

on my website, i want users to be able to tell me the name of an artist, song or album and then get a link to the iTunes Music Store generated. apple does just this on the linked page below:

http://phobos.apple.com/WebObjects/M.../itmsLinkMaker

this is exactly what i want but i can't copy it since it uses their database etc.

i'm using PHP for my website. so i want to put the apple code in an iframe and read the URL from it after each step of their process is loaded (3 steps). all the info i need is in their URL.

thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 01-14-05, 11:55 AM
nassau nassau is offline
Wannabe Coder
 
Join Date: May 2004
Posts: 211
Thanks: 0
Thanked 0 Times in 0 Posts
here's a visual explanation of what i want to do:
http://nassau.free.fr/xdiv/itunesconnection/iframe.php
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 01-21-05, 01:48 AM
nassau nassau is offline
Wannabe Coder
 
Join Date: May 2004
Posts: 211
Thanks: 0
Thanked 0 Times in 0 Posts
ok, thanks for your code beck! i managed to tweak it to work for my application, it's really great.

now, to finalize it i just need to do one last thing, and i can't pull it off myself. using your code above i get the following code returned. i need this to be broken into tables with a new <tr> after every third item. i can wrap all items in <td> but i don't know how to make a <tr> ONLY between every third item.

does anyone have a solution to this.

PHP Code:

<table border="0" cellpadding="0" cellspacing="0" width="600">

    <
tr>
        <
td>
        
Karma


<input type="checkbox" value="songName=Karma&amp;searchType=1&amp;storeFrontId=143441&amp;artistName=Lloyd+Banks&amp;plid=17034873&amp;id=17034795&amp;playlistName=The+Hunger+for+More"></a>


The Hunger for More


<input type="checkbox" value="searchType=2&amp;storeFrontId=143441&amp;artistName=Lloyd+Banks&amp;id=17034873&amp;playlistName=The+Hunger+for+More"></a>


Lloyd Banks


<input type="checkbox" value="id=5499815&amp;searchType=3&amp;storeFrontId=143441&amp;artistName=Lloyd+Banks"></a>Karma


<input type="checkbox" value="songName=Karma&amp;searchType=1&amp;storeFrontId=143441&amp;artistName=Lloyd+Banks&amp;plid=17035099&amp;id=17035034&amp;playlistName=The+Hunger+for+More"></a>


The Hunger for More


<input type="checkbox" value="searchType=2&amp;storeFrontId=143441&amp;artistName=Lloyd+Banks&amp;id=17035099&amp;playlistName=The+Hunger+for+More"></a>


Lloyd Banks


<input type="checkbox" value="id=5499815&amp;searchType=3&amp;storeFrontId=143441&amp;artistName=Lloyd+Banks"></a>Karma


<input type="checkbox" value="songName=Karma&amp;searchType=1&amp;storeFrontId=143441&amp;artistName=Lloyd+Banks&amp;plid=17035383&amp;id=17035283&amp;playlistName=The+Hunger+for+More"></a>


The Hunger for More


<input type="checkbox" value="searchType=2&amp;storeFrontId=143441&amp;artistName=Lloyd+Banks&amp;id=17035383&amp;playlistName=The+Hunger+for+More"></a>


Lloyd Banks


<input type="checkbox" value="id=5499815&amp;searchType=3&amp;storeFrontId=143441&amp;artistName=Lloyd+Banks"></a>


        </
td>
    </
tr<
</
table
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 profitable script sites for sale cms-master.com General Advertisements 3 07-03-07 11:17 AM
Php casestatement URL blessedrub JavaScript 1 01-12-05 09:12 PM
root url in php nassau PHP 22 12-05-04 05:24 PM
OnClick Iframe URL changes? eq1987 JavaScript 2 09-26-04 02:49 PM
iframe linking not working under url masking willNoClue HTML/XHTML/XML 1 08-02-04 11:34 AM


All times are GMT -5. The time now is 10:03 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.