I need to execute a URL in back-end, when ever the page executes, for this I am using file_get_contents(); but sadly it is not processing the url requested, please help me, pardon me if I am wrong, thank you.
.PHP
<?php
$url="http://www.foo.in/bound/bound.php?phone_no=".$from_id."&api_key=xxxxxxxxxxxxxxxxxxxx &bound_version=2&extra_data=<response><dial record='true' limittime='1000' timeout='30' moh='default' >".$to_id."</dial></response>";
$data = file_get_contents($url);
?>
I resolved out the solution there was a gap in URL there was space after api_key and extra_data not encoded, btw thanks for support.
.PHP
$url="http://www.foo.in/bound/bound.php?phone_no=".$from_id."&api_key=xxxxxxxxxxxxxxxxxxxxx=2&extra_data=".urlencode("<response><dial record='true' limittime='1000' timeout='30' moh='default' >".$to_id."</dial></response>");
$data = file_get_contents($url);
echo $data;
Related
who can help me implement getting html code from this page https://investmint.ru? I'm using the "SimpleHTMLDom" library, but something goes wrong and I get an empty response. Although other sites work fine with this code. What's wrong? Who can suggest or give advice?
include("simplehtmldom/simple_html_dom.php");
$url = "https://investmint.ru";
$html = new simple_html_dom();
$html->load_file($url);
echo $html;
I will be glad for any decision, thanks.
I get an empty response...Although other sites work fine with this code
I couldn't be bothered setting up the library, so I ran this....
print file_get_contents('https://investmint.ru');
I got this....
<html><head><script>function set_cookie(){var now = new Date();
var time = now.getTime();time += 19360000 * 1000;now.setTime(time);
document.cookie='beget=begetok'+'; expires='+now.toGMTString()+';
path=/';}set_cookie();location.reload();;</script></head><body></body></html>
I suspect you got the same but didn't investigate it properly.
Try it with the cookie. And learn how to use web developer tools in your browser.
The BTS lab has a page with the following PHP code:
<?php include($_SERVER['DOCUMENT_ROOT'].'/btslab/header.php');
if(isset($_GET['data']))
{
$data = $_GET['data'];
$data = preg_replace('/(.*)/e', 'strtoupper("\\1")',$data);
print $data;
}
include($_SERVER['DOCUMENT_ROOT'].'/btslab/footer.php'); ?>
How should I format some malicious input as the 'data' parameter please?
I've tried various things like ?data=system('ls -lah') without success.
If the directory listing will not work, is there a way to get it to execute phpinfo(); please?
Thanks in advance of your kind response.
As #Don't Panic kindly pointed out the issue I was having relates to the version of PHP installed on the server I am hosting the pen testing lab on.
For anyone else looking to test this vulnerability though, please see this link for some examples of malicious input: http://www.madirish.net/402
<?php
$string = "phpinfo()";
print preg_replace('/^(.*)/e', 'strtoupper(\\1)', $string);
?>
I´m requesting an API like so (Domain is NSFW):
$external_videoid = "ph57fbb82bd33ab";
$string = file_get_contents("http://www.pornhub.com/webmasters/video_by_id?id=".$external_videoid."&thumbsize=big");
$json = json_decode($string, true);
$title = $json["video"]["title"];
echo $string;
But I can´t retrieve any data. $title is empty. The echo gives me:
<html><head>[...]<bodyonload="go()">Loading...</body>[...]</html>
Which might indicate that the JSON I want to retrieve is somehow loading, I guess. Seems pretty clear to me. It seems like file_get_contents has to wait for the site to load. What can I do?
APPEND: Sometimes the request works. Sometimes it doesn´t.
Your code works for me, $title echos as:
I Feel Myself Creature Comforts 1
(lol)
I suppose the connection was ACTUALLY loading when you tried it. The json returns some highly "entertaining" information haha, especially the tags (NSFW obviously)
Be aware pornhub has an API(!): http://www.hubtraffic.com/
Use this code.
$v= "ph57fbb82bd33ab";
$url="http://www.example.com/sample/param?id=".$v;
$data = file_get_contents($url);
$characters=json_decode($data, true);
echo $characters['video']['title'];
When I use this code in a php file in public_html not working :
$badwords = explode("\n", file_get_contents('bad.txt'));
but when i add my site url working this code working nice :
$badwords = explode("\n", file_get_contents('http://example.com/bad.txt'));
What's the problem?
please help me.
thank you.
using file_get_contents() function one can do the other sites data scraping and hence most of the time server doesn't allow to use this function and may be you can get other errors as well.
I am trying to read this url from my php script:
http://test.cellpay.com.np:8181/cellcom?FN=123&fromMobile=01670746301&phoneNumber=01670746301&PIN=123456&amount=0
please load the url first, check the response and tell me what to do.
I tried the following:
file_get_contents
simplexml_load_string
simplexml_load_file
CURL
failed in all cases.
I've saved the xml and upload it to
http://vtopup.tk/1.xml
I can read this, but not the original one.
Please help me. I am tired of searching and applying...
Thanks.
Tested and it's working.
<?php
$url = 'http://test.cellpay.com.np:8181/cellcom?FN=ATW&fromMobile=testuser&phoneNumber=01670746301&PIN=z2ag&amount=0';
$xml = simplexml_load_file($url) or die("feed not loading");
var_dump($xml);
!!!!!!!!!Finally solved!!!!!!!!!
Thats all about php versions
I was trying from PHP 5.4.27, doesn't work....
Finally tried from PHP 5.6.3 and it works. so simply and magically.
Thanks to Veenex and file_get_contents returns empty string
for all effort.
Thank you guys, thank you very much.