Request remote file with file_get_contents()
I need to query a page on another domain and display the results returned by 开发者_JS百科it. But the php
file reports an error.
The url is: http://otherdomain/abc.jsp?p=q&x=y
EDIT: I use file_get_contents...
There can be several reasons:
1) If you're opening a URI with special characters, such as spaces, you need to encode the URI with urlencode().
2) In your php.ini *allow_url_fopen* is false. Set it true to allow opening urls.
I could help if you provide the error generated by php.
If you are trying to make two or more start points access the same one point, you might consider using .htaccess files with RewriteEngine as it will rewrite the url.
If you want to: both index.jsp, index.php, index.aspx.... to show the same output that index.jsp shows.
You can use: .htaccess File with RewriteEngine Support.
Here is the link with some .htaccess tricks
Notice You must have Apache as the HTTP Server and have mod_rewrite module enabled.
精彩评论