Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-14-2013, 06:01 PM   PM User | #1
bm1125
New Coder

 
Join Date: Dec 2012
Posts: 18
Thanks: 13
Thanked 0 Times in 0 Posts
bm1125 is an unknown quantity at this point
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 06:06 PM..
bm1125 is offline   Reply With Quote
Old 02-14-2013, 07:16 PM   PM User | #2
Redcoder
Regular Coder

 
Redcoder's Avatar
 
Join Date: May 2012
Location: /dev/couch
Posts: 309
Thanks: 2
Thanked 46 Times in 45 Posts
Redcoder has a little shameless behaviour in the past
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.
__________________
For professional Hosting and Web design.....


NetEssentials.co.uk
Redcoder is offline   Reply With Quote
Users who have thanked Redcoder for this post:
bm1125 (02-14-2013)
Old 02-14-2013, 09:46 PM   PM User | #3
bm1125
New Coder

 
Join Date: Dec 2012
Posts: 18
Thanks: 13
Thanked 0 Times in 0 Posts
bm1125 is an unknown quantity at this point
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 12:00 AM..
bm1125 is offline   Reply With Quote
Old 02-17-2013, 12:23 PM   PM User | #4
Redcoder
Regular Coder

 
Redcoder's Avatar
 
Join Date: May 2012
Location: /dev/couch
Posts: 309
Thanks: 2
Thanked 46 Times in 45 Posts
Redcoder has a little shameless behaviour in the past
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.
__________________
For professional Hosting and Web design.....


NetEssentials.co.uk
Redcoder is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:46 PM.


Advertisement
Log in to turn off these ads.