deliwasista Posted April 25, 2006 Share Posted April 25, 2006 Hi there, thank you in advance for taking time to help here. I have a site which needs a page called into it from another web site. I can get this working super well with this little script as long as the file url ends in .php or .html <?php include("http://www.thenameofsite.co.nz/thepageIwant.html"); ?>Sadly the page im calling in is a .asp page! <?php include("http://www.thenameofsite.co.nz/redir.asp?page=calendar&OID=O6S4vvxFLyen "); ?>and this doesnt work. My host tells me that the include function I have used is NOT good for calling a .asp file.Does anybody know what I should use instead? can php do this? Quote Link to comment https://forums.phpfreaks.com/topic/8357-can-you-call-an-asp-web-page-into-a-php-page-using-includes/ Share on other sites More sharing options...
wisewood Posted April 25, 2006 Share Posted April 25, 2006 I just gave it a quick test... included various web-pages from various places... but when i tried including [a href=\"http://www.w3schools.com/asp/default.asp\" target=\"_blank\"]http://www.w3schools.com/asp/default.asp[/a] it came up with nothing.I dont think you'll be able to do it... but someone will probably prove me wrong.It is picking up the title of the page though, just not the content. I have also tried require() and that does the same thing Quote Link to comment https://forums.phpfreaks.com/topic/8357-can-you-call-an-asp-web-page-into-a-php-page-using-includes/#findComment-30509 Share on other sites More sharing options...
shocker-z Posted April 25, 2006 Share Posted April 25, 2006 Well if you think of it the only thing you will see is HTML and client side coding as everything else is Serverside so it should just be like including a HTML file in theory.. but i tryed and got this error..Warning: main(): Circular redirect, aborting. in /var/www/phpfreaks/includeasp.php on line 2Warning: main(http://www.pcservicecall.co.uk/Layout.aspx): failed to open stream: Success in /var/www/phpfreaks/includeasp.php on line 2Warning: main(): Failed opening 'http://www.pcservicecall.co.uk/Layout.aspx' for inclusion (include_path='/usr/share/php/') in /var/www/phpfreaks/includeasp.php on line 2just tryed fopen and file also gettin same erors.. tryed a diffrent address and this works<?php$asp=file('http://www.asp.net/Default.aspx');foreach ($asp as $line) {echo($line);}?>however using include<?phpinclude('http://www.asp.net/Default.aspx');?>works also but took ALOT longer to load.. Quote Link to comment https://forums.phpfreaks.com/topic/8357-can-you-call-an-asp-web-page-into-a-php-page-using-includes/#findComment-30523 Share on other sites More sharing options...
deliwasista Posted April 25, 2006 Author Share Posted April 25, 2006 Thank you so much Wisewood and Shocker for taking the time to have a look at this. I am ecstatic to report Shocker that your option: <?php$asp=file('http://www.asp.net/Default.aspx');foreach ($asp as $line) {echo($line);}?>works a dream with the asp url I have also!! For future reference with others having the same problem you may find this helpful to know - the site owner gave me two url options (site name has been replaced with xxxxx)[a href=\"http://www.XXXXXX.co.nz/redir.asp?page=calendar&OID=O6S4vvxFLyen\" target=\"_blank\"]http://www.XXXXXX.co.nz/redir.asp?page=cal...ID=O6S4vvxFLyen[/a] or[a href=\"http://www.XXXXXX.co.nz/events/eventcalendar.asp?EName=&OrganizerID=O6S4vvxFLyen\" target=\"_blank\"]http://www.XXXXXX.co.nz/events/eventcalend...ID=O6S4vvxFLyen[/a] I dont know much about .asp (or much else for that matter!) but it looks like the first option is a "redirect" and this definately does not work. However using Shockers suggestion the second url does.Thanks so much Shocker you are a legend! Quote Link to comment https://forums.phpfreaks.com/topic/8357-can-you-call-an-asp-web-page-into-a-php-page-using-includes/#findComment-30721 Share on other sites More sharing options...
deliwasista Posted April 27, 2006 Author Share Posted April 27, 2006 Just in case you guys are still watching this one - or someone else thinks that this was the final answer.. its not yet.....owwww ..... Sadly although this works the gif images on the called asp page do not show!. I have spent ages browsing for an answer and found a suggestion using absolute paths to images. The owner of the other site tells me they can not use "absolute paths" to their images as his "pages are based upon site variables file".This is the test page in question (style sheet yet to be connected). [a href=\"http://www.totalsport.co.nz/events/legend/index2.php\" target=\"_blank\"]http://www.totalsport.co.nz/events/legend/index2.php[/a]Is there something I can add to my php to MAKE the asp file download its images?? Quote Link to comment https://forums.phpfreaks.com/topic/8357-can-you-call-an-asp-web-page-into-a-php-page-using-includes/#findComment-31186 Share on other sites More sharing options...
darga333 Posted April 27, 2006 Share Posted April 27, 2006 I dont understand why you couldnt just use file_get_contents(file_name);and use php to replace the variables so you get your images and everythingdo you store your image paths in the database? if so it should be easy do a query to get all the variables you need including the image locationsin the page that you want all of the images to show, etc. just put place holders in their spot and use str_replace to swap the placeholders with the stuff you want to showex. $message = file_get_contents("mailer_template.php");$message = str_replace("%REP%",$rep,$message);$message = str_replace("%USERNAME%",$username,$message);$message = str_replace("%PASS%",$pass,$message);$message = str_replace("%BUSINESS_NAME%",$business_name,$message);$message = str_replace("%DISCOUNT_MESSAGE%",$discount_message,$message);i'm a newbie so i may be completely wrong, but i just learned about str_replace today and it worked like a charm for me! either way let me know! Quote Link to comment https://forums.phpfreaks.com/topic/8357-can-you-call-an-asp-web-page-into-a-php-page-using-includes/#findComment-31209 Share on other sites More sharing options...
deliwasista Posted April 27, 2006 Author Share Posted April 27, 2006 Hey Daarga,wow thanks heaps for having a look! hmmm now ive had a look at your posts and I think you are several levels above me in term of php understanding. Bear with me tho as I really want to try this, but im a bit shonky on my php abilities. All "muscle" no "brain" so to speak.So if two images lived here www.pretendsite.co.nz/images/blank.gif and bar.gifI would do this:<?php $asp=file('http://www.enteronline.co.nz/results/results.asp?db=05Legend');foreach ($asp as $line) {echo($line);?><?php $message = file_get_contents("'http://www.enteronline.co.nz/images");$message = str_replace("%BLANK%",$blank.gif,$message);$message = str_replace("%BAR%",$bar.gif,$message);?>man that probably looks like gibberish.. help. Quote Link to comment https://forums.phpfreaks.com/topic/8357-can-you-call-an-asp-web-page-into-a-php-page-using-includes/#findComment-31223 Share on other sites More sharing options...
darga333 Posted April 27, 2006 Share Posted April 27, 2006 well from what i understand, you can not file_get_contents is to get the contents of a file not a directoryso you need to get the contents of your file that u want stuff to show up in<?php $blank = "location for blank.gif";$bar = "location for bar.gif";$message = file_get_contents("some_file");//then you want to check that entire file called some_file, and replace the variables with what you want$message = str_replace("%BLANK%",$blank,$message);$message = str_replace("%BAR%",$bar,$message);?>remember, you would need to go through your some_file and replace the entire location of those variables with %BLANK% or %BAR% but honestly i have no idea what you are actually tryign to do here.. that just worked for me because i was using some_file as a email_template.. then i had to strip the shit and replace it just so i can get my php variables inside that file. but seriously, come back to me in a good 3 months, i will probably know what i am talking about theni am very sorry i couldnt help more Quote Link to comment https://forums.phpfreaks.com/topic/8357-can-you-call-an-asp-web-page-into-a-php-page-using-includes/#findComment-31435 Share on other sites More sharing options...
deliwasista Posted April 28, 2006 Author Share Posted April 28, 2006 Hehe you rock Darga! thank you for even trying to answer this one for me - frankly even a wrong answer is better than no answer! Im going to have a go at this and see if It will do for me what I need. I have set up a newsletter in the past and am familiar with replacing text with dynamic information eg NAME etc but not sure if this works in the same way.. mostly cause I dont really know any php.ps I see you are looking for a newsletter prog. I got a good free one off hotscripts.com. It was a free one and despite my lack of php knowledge I still got it running - with determination!Will post back here if this works or if I find a solution or lack there of! soon. Quote Link to comment https://forums.phpfreaks.com/topic/8357-can-you-call-an-asp-web-page-into-a-php-page-using-includes/#findComment-31542 Share on other sites More sharing options...
deliwasista Posted April 29, 2006 Author Share Posted April 29, 2006 Ive retreived the answer from another forum so for those of you reading this who are looking to do the same this is what im now using <?php ini_set (user_agent, "Your Name Here");ini_set (default_socket_timeout, "3");error_reporting(0);$theurl="http://www.yoursite.co.nz/events/eventcalendar.asp";$filestring=file_get_contents("$theurl");$filestring = str_replace("../images/", "http://www.yoursite.co.nz/images/", $filestring);//change the "../images/" to the path that your asp page is using (view page source to get this) and repeat a new line using str_replace for each item you want changed in the asp pageecho "$filestring"; ?>and this brings the asp page in and the images show up. Now if anyone knows how to turn off selected url links within the called asp page I would love to know! Quote Link to comment https://forums.phpfreaks.com/topic/8357-can-you-call-an-asp-web-page-into-a-php-page-using-includes/#findComment-32053 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.