Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Dec 2012
    Posts
    18
    Thanks
    13
    Thanked 0 Times in 0 Posts

    PHP allow url include

    Hey,

    I have been using JS to make api calls but after I've been told that the only way to make this work is by using proxy, I tried to change my code a little but then I got error that allow url include is disabled.

    I read on the net that this function is disabled for security purposes and there's a wayaround it. so I set this code

    myProxy.php
    Code:
    <?php
    $page = ($_GET['page']) ? $_GET['page'] : "default.php";
    ?>
    This is the js code for page to invoke the service

    Search.js
    Code:
    var API = new Tiggr.RestService({
        'url': 'myProxy.php?page=http://api.indeed.com/ads/apisearch',
        'dataType': 'xml',
        'type': 'get',
    });
    I guess I must be doing something wrong here because I still can't make any calls on a cross domain.


    Any suggestions?



    Thanks.
    Last edited by bm1125; 02-15-2013 at 07:06 PM.

  • #2
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    335
    Thanks
    2
    Thanked 49 Times in 48 Posts
    If your hosting has cURL installed, use it. It provides better and more options.

    Otherwise, edit the php.ini file and set :

    Code:
    allow_url_fopen = On
    Although this does open up some security vulnerabilities in your site.

  • Users who have thanked Redcoder for this post:

    bm1125 (02-14-2013)

  • #3
    New Coder
    Join Date
    Dec 2012
    Posts
    18
    Thanks
    13
    Thanked 0 Times in 0 Posts
    Hey Redcoder,

    So lets say I use this myProxy.php to make call to API servers.

    Is it possible to create a php code making an api code and generating XML output?
    Last edited by bm1125; 02-15-2013 at 01:00 AM.

  • #4
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    335
    Thanks
    2
    Thanked 49 Times in 48 Posts
    BM1125, sorry for replying so late.

    Well, you can do whatever you want with data returned by the API. If the API returns data in JSON, you can do your own code that makes an XML document for the data. But off course if you don't want to resend the data or make it available to users in maybe RSS form, there's no need to covert, just work on the data the way it is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •