0

i am using the curl to fetch the data from the url link and is working fine but the issue is that the response data uses the ajax call but all these ajax call are using my server domain but i need them to use the original path of the ajax call, where the files are located. E.g

/ajax/fetch.php changes to http://original-domain.com/ajax/fetch.php

please tell me the appropriate solution for this problem.

Ajay Choudhary
  • 271
  • 3
  • 16

1 Answers1

2

You need to convert a relative URL to an absolute one, take a look at this: Transfrom relative path into absolute URL using PHP

Something like rel2abs('/ajax/fetch.php', 'http://original-domain.com/ajax');

Community
  • 1
  • 1
preinheimer
  • 3,712
  • 20
  • 34
  • I think his problem is not relative vs absolute url but same-origin policy. Absolute url is useless in ajax since you can only connect to your own server anyway. Unless of course you want to use CORS. – slebetman Sep 05 '13 at 19:49
  • same origin is irrelevant, the calls are being made with curl, not the web browser. – preinheimer Sep 05 '13 at 19:56
  • If it's using curl then it's not ajax. It's only ajax when it's done in the web browser. I think we're not getting the full picture of what he's trying to do. – slebetman Sep 05 '13 at 20:24