1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Can you call an .asp web page into a php page using includes??

Discussion in 'PHP' started by Deliwasista, Apr 25, 2006.

  1. jpcesar

    jpcesar Peon

    Messages:
    243
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #21
    dudes... why don't you just put an iframe to that asp page ?
     
    jpcesar, Apr 28, 2006 IP
  2. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #22
    Probably because the content needs to be indexed by search engines or something.
     
    mad4, Apr 28, 2006 IP
  3. Mystique

    Mystique Well-Known Member

    Messages:
    2,579
    Likes Received:
    94
    Best Answers:
    2
    Trophy Points:
    195
    #23
    Thanks for this code

    I will try it because I have a site on a Windows Server but with php support that works pretty fine, however I have been trying to include an ASP page into the php with no results, including the trick of iframed it
     
    Mystique, Apr 28, 2006 IP
  4. Deliwasista

    Deliwasista Member

    Messages:
    35
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #24
    wow mad4 may the sun shine over Nottingham for the rest of the week!!! :)

    I have images galore! you were right the wee "i" was holding it all up changing it to caps sorted the entire page and now all the images are hunky dory!!!

    So this "str_replace" is quite a handy snippet of code isnt it.. could one use this same idea to sort out the links on the called asp page also so that they travel to the right urls? Im going to try it and find out :)

    Thank you from the bottom of my heart Mad4 for taking the time to look at this for me. I was quite stuck! without your help and knowledge I would still be stuck!!! The more I see of php the more I like it :)

    Im smiling down here in Auckland!!!
     
    Deliwasista, Apr 28, 2006 IP
  5. Deliwasista

    Deliwasista Member

    Messages:
    35
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #25
    Het Mystique - try Mad4s suggestions with ini set etc (see back thru replys) I am not using the $asp=file thing and using this instead and its working perfectly. I had trouble with the images not showing from the asp file - and his suggestion of using "str_replace" now has them all showing also.. best of luck!! Its awesome when you get it working!!
     
    Deliwasista, Apr 28, 2006 IP
  6. Deliwasista

    Deliwasista Member

    Messages:
    35
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #26
    Excellent!

    Now i have some links on the asp page I would like to do two things to. This doesnt seem a simple task. I have two requirements.

    Here are the two issues:

    1) some links in the asp page return users back to the other site. I dont want this
    2) Some links are wanted but open up the other sites asp pages over the top of my site.

    Heres what I would like:

    1) deactivate some links altogether as they take users back to the other persons site (which is not wanted.)

    2) change some so that they call the new page from the other site in place of the original asp page

    Ive tried replacing the urls in question with:

    $filestring = str_replace("../events/eventdetail.asp?eventid=ZDM091261", "", $filestring);

    Which I thought would remove it altogether - but the link remains active and when clicked then sends the user to the index page in my directory the page sits in.

    Ive also tried
    $filestring = str_replace("a href="../events/eventdetail.asp?eventid=ZDM091261"", "", $filestring);
    a href= but the system didnt seem to like all the additional " involved in the lineup.

    Has anyone managed this before?
     
    Deliwasista, Apr 28, 2006 IP
  7. Deliwasista

    Deliwasista Member

    Messages:
    35
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #27
    is this a mod rewrite kind of thing?
     
    Deliwasista, Apr 28, 2006 IP
  8. Mystique

    Mystique Well-Known Member

    Messages:
    2,579
    Likes Received:
    94
    Best Answers:
    2
    Trophy Points:
    195
    #28
    I had a pending job to finish before try this, but I'm about to check it right now.

    mod_rewrite does not work on Windows Based servers because it requires the use of directives via your .htaccess file, which is a not supported on a Windows online environment
     
    Mystique, Apr 29, 2006 IP
  9. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #29
    If you are using a " in the string then you need to escape it by writing \" instead.
     
    mad4, May 1, 2006 IP
  10. Deliwasista

    Deliwasista Member

    Messages:
    35
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #30
    Hi mad4 thanks for that - have you ever come across using string_replace to completely remove a url link? the second part of the string asks for the replacement but when I leave that empty eg "" it doesnt work. Is this task a misuse of string_replace?
     
    Deliwasista, May 1, 2006 IP
  11. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #31
    That should work fine (I use it myself). Its probably the first part that is not matching the right text.
     
    mad4, May 2, 2006 IP
  12. cosborn

    cosborn Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #32
    I've run into an issue trying to do something similar to what you're doing. I've got the page to load and work just fine except for one thing, and I swear it has to do with IIS or the ASP.net engine.

    Here's what I used:

    ------------------------------------------------------------
    $handle = fopen("http://youraddresshere.com/","rb");
    while (!feof($handle)) {
    $content .= fread($handle, 8192);
    }
    fclose($handle);
    ------------------------------------------------------------

    It works fine except for Javascript that the ASP.net engine inserts into the code for certain ASP.net web user controls. The page I'm loading in has a "Log In" .Net framework control on it, which requires some javascript to exist for it to function.

    If I hit the ASP page directly and do a View Source from the browser this what is properly returned:

    ------------------------------------------------------------
    <form name="aspnetForm" method="post" action="default.aspx" id="aspnetForm">
    <div>
    <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
    <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJMjUzNTk5OTE4D2QWAmYPZBYCAgMPZBYEAgMPZBYCAgIPZBYCZg9
    kFgJmD2QWBGYPDxYCHgRUZXh0BQ1Ob3QgTG9nZ2VkIEluZGQCAg8PFgIfAAUGTG9nIEluZGQCBQ9kFgYCAg9kFgJmD2QWAgIBD2QWAmYPZBYIZg9kFgJmDw8
    WBB4IQ3NzQ2xhc3MFFWxlZnROYXZTZWxlY3Rpb25DbGFzcx4EXyFTQgICFgIeB29uY2xpY2sFKGphdmFzY3JpcHQ6bG9jYXRpb24uaHJlZj0nZGVmYXVsdC5hc3B4
    JztkAgEPZBYCZg8PZBYCHwMFKWphdmFzY3JpcHQ6bG9jYXRpb24uaHJlZj0nZnVsbGxpc3QuYXNweCc7ZAICD2QWAmYPD2QWAh8DBSdqYXZhc2NyaXB0OmxvY
    2F0aW9uLmhyZWY9J3NlYXJjaC5hc3B4JztkAgMPZBYCZg8PZBYCHwMFKmphdmFzY3JpcHQ6bG9jYXRpb24uaHJlZj0nZmF2b3JpdGVzLmFzcHgnO2QCBg8PFgIeB1
    Zpc2libGVoZGQCCA8PFgIfBGhkFgJmD2QWAgIBD2QWAmYPZBYGZg9kFgJmDw9kFgIfAwUsamF2YXNjcmlwdDpsb2NhdGlvbi5ocmVmPSdhZG1pbkdlbnJlcy5hc3B4
    JztkAgEPZBYCZg8PZBYCHwMFKmphdmFzY3JpcHQ6bG9jYXRpb24uaHJlZj0nYWRtaW5DYXN0LmFzcHgnO2QCAg9kFgJmDw9kFgIfAwUsamF2YXNjcmlwdDpsb2
    NhdGlvbi5ocmVmPSdhZG1pbk1vdmllcy5hc3B4JztkZLsX5VNSVYSp9PBlZ7M6tTrALUQV" />
    </div>

    <script type="text/javascript">
    //<![CDATA[
    var theForm = document.forms['aspnetForm'];
    if (!theForm) {
    theForm = document.aspnetForm;
    }
    function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
    theForm.__EVENTTARGET.value = eventTarget;
    theForm.__EVENTARGUMENT.value = eventArgument;
    theForm.submit();
    }
    }
    //]]>
    </script>
    ------------------------------------------------------------

    However, if I hit that same page by means of the PHP fopen my view source looks like this instead:

    ------------------------------------------------------------
    <form name="aspnetForm" method="post" action="default.aspx" id="aspnetForm">
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJMjUzNTk5OTE4D2QWAmYPZBYCAgMPZBYEAgMPZBYCAgIPZBYCZg9
    kFgJmD2QWBGYPDxYCHgRUZXh0BQ1Ob3QgTG9nZ2VkIEluZGQCAg8PFgIfAAUGTG9nIEluZGQCBQ9kFgYCAg9kFgJmD2QWAgIBD2QWAmYPZBYIZg9kFgJmDw8
    WBB4IQ3NzQ2xhc3MFFWxlZnROYXZTZWxlY3Rpb25DbGFzcx4EXyFTQgICFgIeB29uY2xpY2sFKGphdmFzY3JpcHQ6bG9jYXRpb24uaHJlZj0nZGVmYXVsdC5hc3B4
    JztkAgEPZBYCZg8PZBYCHwMFKWphdmFzY3JpcHQ6bG9jYXRpb24uaHJlZj0nZnVsbGxpc3QuYXNweCc7ZAICD2QWAmYPD2QWAh8DBSdqYXZhc2NyaXB0OmxvY
    2F0aW9uLmhyZWY9J3NlYXJjaC5hc3B4JztkAgMPZBYCZg8PZBYCHwMFKmphdmFzY3JpcHQ6bG9jYXRpb24uaHJlZj0nZmF2b3JpdGVzLmFzcHgnO2QCBg8PFgIeB1
    Zpc2libGVoZGQCCA8PFgIfBGhkFgJmD2QWAgIBD2QWAmYPZBYGZg9kFgJmDw9kFgIfAwUsamF2YXNjcmlwdDpsb2NhdGlvbi5ocmVmPSdhZG1pbkdlbnJlcy5hc3B4
    JztkAgEPZBYCZg8PZBYCHwMFKmphdmFzY3JpcHQ6bG9jYXRpb24uaHJlZj0nYWRtaW5DYXN0LmFzcHgnO2QCAg9kFgJmDw9kFgIfAwUsamF2YXNjcmlwdDpsb2
    NhdGlvbi5ocmVmPSdhZG1pbk1vdmllcy5hc3B4JztkZLsX5VNSVYSp9PBlZ7M6tTrALUQV" />
    ------------------------------------------------------------

    Some of the hidden EVENTTARGET fields and all of the ASP.net generated javascript are missing, which of course doesn't allow the page to function properly.

    --Clay
     
    cosborn, Jul 31, 2008 IP