This question already has answers here:
How do I ignore a moved-header with file_get_contents in PHP?
(3 answers)
Closed 8 years ago.
I am trying to get contents of a Website with simple html DOM as follows:
<?php
include_once('../simple_html_dom.php');
$html = file_get_html('http://www.opaltransfer.com/en');
echo($html);
?>
When i run this on my localhost everything works fine, However when i try to run it on a remote server i am getting
Found
The document has moved here.
Why? and what can i do to get it to work? Thanks in advance
You're missing a / at the end of the URL.
Related
This question already has answers here:
How to show <div> tag literally in <code>/<pre> tag?
(11 answers)
Closed 2 years ago.
Im actively practicing with php regex and got stuck with a replace function as it shows absolutely different results from tutorial I copied it from.
So the function preg_replace('/\{([a-z]+)\}/', '(?P<\1>[a-z-]+)', '{controller}\/{action}') should give me this result in the output: (?P<controller>[a-z-]+)\/(?P<action>[a-z-]+). phpliveregex.com confirms that https://www.phpliveregex.com/p/wIF
However, this is what my browser on my localhost is outputing me in fact: (?P[a-z-]+)\/(?P[a-z-]+).
How is that possible? Is my php broken or the preg_replace function is working differentely now? My php version is 7.4.4
Your browser interprets the <controller> and <action> as html tags and tries to parse them that leads to deleting them. see this to see how can you show tags literally using html encoding.
(?P<controller>[a-z-]+)\/(?P<action>[a-z-]+)
<br/>
(?P<controller>[a-z-]+)\/(?P<action>[a-z-]+)
You can maybe replace it with (?P<\1>[a-z-]+)
This question already has an answer here:
decoding eval(base64_decode))
(1 answer)
Closed 3 years ago.
I have the following encoded codes! It will decode itself and run with eval() function, is any solution to get the decoded codes that run by server?!
<?php /*** PHP Encode v1.0 by zeura.com ***/ $XnNhAWEnhoiqwciqpoHH=file(__FILE__);eval(base64_decode("aWYoIWZ1bmN0aW9uX2V4aXN0cygiWWl1bklVWTc2YkJodWhOWUlPOCIpKXtmdW5jdGlvbiBZaXVuSVVZNzZiQmh1aE5ZSU84KCRnLCRiPTApeyRhPWltcGxvZGUoIlxuIiwkZyk7JGQ9YXJyYXkoNjU1LDIzNiw0MCk7aWYoJGI9PTApICRmPXN1YnN0cigkYSwkZFswXSwkZFsxXSk7ZWxzZWlmKCRiPT0xKSAkZj1zdWJzdHIoJGEsJGRbMF0rJGRbMV0sJGRbMl0pO2Vsc2UgJGY9dHJpbShzdWJzdHIoJGEsJGRbMF0rJGRbMV0rJGRbMl0pKTtyZXR1cm4oJGYpO319"));eval(base64_decode(YiunIUY76bBhuhNYIO8($XnNhAWEnhoiqwciqpoHH)));eval(ZsldkfhGYU87iyihdfsow(YiunIUY76bBhuhNYIO8($XnNhAWEnhoiqwciqpoHH,2),YiunIUY76bBhuhNYIO8($XnNhAWEnhoiqwciqpoHH,1)));__halt_compiler();aWYoIWZ1bmN0aW9uX2V4aXN0cygiWnNsZGtmaEdZVTg3aXlpaGRmc293Iikpe2Z1bmN0aW9uIFpzbGRrZmhHWVU4N2l5aWhkZnNvdygkYSwkaCl7aWYoJGg9PXNoYTEoJGEpKXtyZXR1cm4oZ3ppbmZsYXRlKGJhc2U2NF9kZWNvZGUoJGEpKSk7fWVsc2V7ZWNobygiRXJyb3I6IEZpbGUgTW9kaWZpZWQiKTt9fX0=c86f0c50b87a0b21633e9a7752465da7914bc8bbbZJRa8IwFIXfBf9DLGOJoO3co6NuMgbbg8wH3+Yoobm10ZiEJGXq2H9f0qpQ6dNNz739cnISRh1kDApaCZc5voeTkpBZcATPLafJCkpDJR4+9Xu8QGRQcAEZHLh1luAFZSC4hKVRTsVCbfBwiH77PYQq6fVd54Qn/fV7Xbj9eTjWpb6SEMqVPhJcOqftNEl0SU18mdQ19nA8Ja1/R+iG1ezJZS4qBjdN37tr2UQpkvCD1oxKtVm3Wuv58oPgN8GPdLW4uqj5bcZ4Zh01jtSdEKuHMh81id6nPKpVHyvzaihkMpo8PnRR8pJKCcKOZ1vF5WvzRb7wWcconSH80hgCusDfAVIHFoXAfF5U8zGEvtvHeZH4K1AqnPsZigJyl9Y+7h0c/DIYjUY4lHirN53n0qUv3k+lhaLMi+EKl0H0tsK68XRl1I4gLxXCn7tBSPvyNsAYZbLmTfwD
Have you tried to do this:
echo base64_decode("aWYoIWZ1bmN0aW9uX2V4aXN0cygi ...
?
You should see the encoded code.
This question already has answers here:
Get fragment (value after hash '#') from a URL [closed]
(10 answers)
Closed 7 years ago.
I'm trying to get the URL query next the "#!" prefix, for example:
https://mega.co.nz/#!123abc
<?php
$query=$_GET["#!"]; //the example
?>
$query: 123abc.
It is possible to read the query using PHP or .htaccess file? How i can get started?
Thanks for reading and for any help! :)
Try this,
Let your URL:
https://mega.co.nz?query=123abc
Then you can get value as below :
<?php
$query=$_GET["query"]; //the example
?>
This question already has answers here:
What is the difference between POST and GET? [duplicate]
(7 answers)
Closed 7 years ago.
I have no time and too tired to struggle with this, so I decided to ask here: I've created the file my.php which contains only:
<?php var_dump( $_POST ); ?>
And then I open the file using browser like this:
www.domain.com/my.php?post1=hey&post2=ho&post3=letsgo
And in the browser I have array(0) { } as a response.
Question: What could I possibly done wrong??
Thanks!
In URL are GET parameters, not POST.
echo $_GET['post1']; // hey
echo $_GET['post2']; // ho
echo $_GET['post3']; // letsgo
You cant pass POST variables through URL.
u r using GET method..
This question already has answers here:
Why I'm getting 500 error when using file_get_contents(), but works in a browser?
(2 answers)
Closed 7 years ago.
I don't know why but I always got this error when I want to get PHP data with file_get_contents.
I have checked my PHP.ini and allow_url_fopen is: ON so that couldn't be the problem.
Here is the code I'm using:
$id='54352';
$url='http://www.google.com';
$data = file_get_contents('http://www.####.###/###.php?id='.$id.'&url='.urlencode($url));
var_dump($data);
I don't know what is going on here, I just get this error message and the value: bool(false).
I have also tried cURL, but it doesn't return ANY value to me.
Can anyone please help me?
Try something like:
$data = file_get_contents('http://www.####.###/###.php?id='.$id.'&url='.urlencode($url),true);