How to open url called by AJAX

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
voltmachine
Forum Newbie
Posts: 7
Joined: Tue Aug 26, 2008 1:30 am

How to open url called by AJAX

Post by voltmachine »

Hi, I have this problem:

I need to read ajax data from: soccerway.com/
When click on leagues headers the site use ajax to display the data.

I catch ajax url with URL Snooper:
soccerway.com/ajax.php?block_id=block_home_matches_6&block_name=block_home_matches&callback_params=%7B%22date%22%3A%20%222009-01-22%22%2C%20%22now_playing%22%3A%20false%7D&action=showMatches&params=%7B%22competition_id%22%3A%20573%7D

But the problem is I can't see data when type this url in browser. I tried with php - CURL, fopen , etc...
I tried also urlencode ir urldecode the url , but can't see data. Everytime I see Page Not Found.

Here how is made url, the site use JSON:
Ajax.Request("/ajax.php",{method:"get",parameters:{block_id:j.id,block_name:j.name,callback_params:Object.toJSON(j.params),action:e,params:Object.toJSON(i||{})}

Can some help me to read data from these ajax urls ?
Is it possible to have some type of defense, based on IP or something misspell on url ?
Last edited by voltmachine on Sat Jan 24, 2009 2:10 pm, edited 1 time in total.
mattpointblank
Forum Contributor
Posts: 304
Joined: Tue Dec 23, 2008 6:29 am

Re: How to open url called by AJAX

Post by mattpointblank »

You need to make a file called ajax.php which does something with the $_GET['block_id'] etc values.
voltmachine
Forum Newbie
Posts: 7
Joined: Tue Aug 26, 2008 1:30 am

Re: How to open url called by AJAX

Post by voltmachine »

Can you explain in detail, please.
What will help if I made ajax.php on my pc ?
mattpointblank
Forum Contributor
Posts: 304
Joined: Tue Dec 23, 2008 6:29 am

Re: How to open url called by AJAX

Post by mattpointblank »

Your code is sending data to a page called ajax.php - you need to create this page so you can do something with the data.
voltmachine
Forum Newbie
Posts: 7
Joined: Tue Aug 26, 2008 1:30 am

Re: How to open url called by AJAX

Post by voltmachine »

Maybe I not explain my first post correctly.
I not need to do anything with data.

I just need to open urls: soccerway.com/ajax.php?.... from my pc (using fopen() for example) to get soccer results.

The ajax.php is in the soccerway.com and return data when you navigate on the site, but when type these links in browser will see page not found.
So maybe have some type of defense or something other with these JSON symbols in the url.
Last edited by voltmachine on Sat Jan 24, 2009 1:56 pm, edited 1 time in total.
voltmachine
Forum Newbie
Posts: 7
Joined: Tue Aug 26, 2008 1:30 am

Re: How to open url called by AJAX

Post by voltmachine »

No one can help me ? :?
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: How to open url called by AJAX

Post by Mark Baker »

voltmachine wrote:The ajax.php is in the soccerway.com and return data when you navigate on the site, but when type these links in browser will see page not found.
So maybe have some type of defense or something other with these JSON symbols in the url.
If they do have some kind of defence, then it's there for a reason, and I'm disinclined to tell anybody how to "hack" that defence.

However, if your browser page is making an Ajax call to the external http://soccerway.com/ajax.php site, then it's a javascript/Ajax problem, not a PHP problem.
If you're trying to make the call from within PHP (usinf fopen, curl or similar), then you're not making an Ajax call.
voltmachine
Forum Newbie
Posts: 7
Joined: Tue Aug 26, 2008 1:30 am

Re: How to open url called by AJAX

Post by voltmachine »

Thanks for all :wink: it works now, looks like was temporary problem with new version of the site.
Post Reply