Call an asp script from php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lucyachammond@yahoo.co.uk

    Call an asp script from php

    I have a 3rd party real-estate website written in php. I would like to
    call an asp script on a separate webserver each time a new real-estate
    item is added to the database on the php site.

    The asp script updates a sql server database for another site and once
    the page has been called, I do not need any return information from it.
    I have searched the groups but cannot find a definitive way of making
    the call to the asp script - I am a asp programmer, new to php so any
    help would be much appreciated.

  • Andy Hassall

    #2
    Re: Call an asp script from php

    On 9 Jul 2006 12:36:38 -0700, lucyachammond@y ahoo.co.uk wrote:
    >I have a 3rd party real-estate website written in php. I would like to
    >call an asp script on a separate webserver each time a new real-estate
    >item is added to the database on the php site.
    >
    >The asp script updates a sql server database for another site and once
    >the page has been called, I do not need any return information from it.
    I have searched the groups but cannot find a definitive way of making
    >the call to the asp script - I am a asp programmer, new to php so any
    >help would be much appreciated.
    fopen can (under the most common configuration, although it can be disabled)
    open URLs as if they were files, so you can use that to make a GET request to
    an ASP page. http://uk.php.net/fopen

    For more complex cases (POST, cookies, finer control over timeouts etc.)
    there's cURL: http://uk.php.net/manual/en/ref.curl.php

    --
    Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
    http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

    Comment

    • lucyachammond@yahoo.co.uk

      #3
      Re: Call an asp script from php

      Many Thanks Andy,
      That works fine!


      Andy Hassall wrote:
      On 9 Jul 2006 12:36:38 -0700, lucyachammond@y ahoo.co.uk wrote:
      >
      I have a 3rd party real-estate website written in php. I would like to
      call an asp script on a separate webserver each time a new real-estate
      item is added to the database on the php site.

      The asp script updates a sql server database for another site and once
      the page has been called, I do not need any return information from it.
      I have searched the groups but cannot find a definitive way of making
      the call to the asp script - I am a asp programmer, new to php so any
      help would be much appreciated.
      >
      fopen can (under the most common configuration, although it can be disabled)
      open URLs as if they were files, so you can use that to make a GET request to
      an ASP page. http://uk.php.net/fopen
      >
      For more complex cases (POST, cookies, finer control over timeouts etc.)
      there's cURL: http://uk.php.net/manual/en/ref.curl.php
      >
      --
      Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
      http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

      Comment

      • lucyachammond@yahoo.co.uk

        #4
        fopen parameters

        I am now trying to call my asp script but have having problems with the
        parameters I am passing. My code is below:

        $handle =
        fopen("http://www.homeplots.c o.uk/processhpdetail s.asp?postcode= {$this->zip}&city={$th is->city}&price=$t his->price&caption= {$this->caption}&id=$t his->property_id&ty pe=$this->type",
        "r");

        I get the error:
        Warning:
        fopen('http://www.homeplots.c o.uk/processhpdetail s.asp?postcode= MK17
        0SJ&city=Swanbo urne&price=1250 00&caption=Buil ding Plot in
        Swanbourne&id=7 8&type=SF'): failed to open stream: No such file or
        directory in
        /home/fhlinux185/h/homeplots.eu/user/htdocs/property_class. php on line
        486

        The asp file definately exists but I cannot pass it the parameters. I
        think the problem is to do with passing strings but do not know php
        well enough to figure it out.

        Again, any help much appreciated.
        Lucy

        lucyachammond@y ahoo.co.uk wrote:
        Many Thanks Andy,
        That works fine!
        >
        >
        Andy Hassall wrote:
        On 9 Jul 2006 12:36:38 -0700, lucyachammond@y ahoo.co.uk wrote:
        >I have a 3rd party real-estate website written in php. I would like to
        >call an asp script on a separate webserver each time a new real-estate
        >item is added to the database on the php site.
        >
        >The asp script updates a sql server database for another site and once
        >the page has been called, I do not need any return information from it.
        I have searched the groups but cannot find a definitive way of making
        >the call to the asp script - I am a asp programmer, new to php so any
        >help would be much appreciated.
        fopen can (under the most common configuration, although it can be disabled)
        open URLs as if they were files, so you can use that to make a GET request to
        an ASP page. http://uk.php.net/fopen

        For more complex cases (POST, cookies, finer control over timeouts etc.)
        there's cURL: http://uk.php.net/manual/en/ref.curl.php

        --
        Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
        http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

        Comment

        • Rik

          #5
          Re: fopen parameters

          lucyachammond@y ahoo.co.uk wrote:
          I am now trying to call my asp script but have having problems with
          the
          parameters I am passing. My code is below:
          >
          $handle =
          >
          fopen("http://www.homeplots.c o.uk/processhpdetail s.asp?postcode= {$this->zip}
          &city={$this->city}&price=$t his->price&caption= {$this->caption}&id=$t his->pr
          operty_id&type= $this->type",
          "r");
          >
          I get the error:
          Warning:
          fopen('http://www.homeplots.c o.uk/processhpdetail s.asp?postcode= MK17
          0SJ&city=Swanbo urne&price=1250 00&caption=Buil ding Plot in
          Swanbourne&id=7 8&type=SF'): failed to open stream: No such file or
          directory in
          /home/fhlinux185/h/homeplots.eu/user/htdocs/property_class. php on line
          486
          >
          The asp file definately exists but I cannot pass it the parameters. I
          think the problem is to do with passing strings but do not know php
          well enough to figure it out.
          >
          Again, any help much appreciated.
          Lucy

          First of all, rawurlencode() your parameters, 'Building Plot in Swanbourne'
          should be 'Building%20Plo t%20in%20Swanbo urne'.

          If that doesn't work, check allow_url_fopen :


          Grtz,
          --
          Rik Wasmus


          Comment

          Working...