MySQL_Narb Posted February 21, 2013 Share Posted February 21, 2013 In the PHP section because I believe the error is on the PHP side. I got my index page: <html> <head> <title>YTBypass</title> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ requestPage(); $('a[href]').click(function( e ){ e.preventDefault(); url = $(this).attr('href'); url = (url == '/') ? 'http://www.youtube.com' : url; requestPage(url); }); function requestPage(pageURL){ $('#loading').show(1500); //request page $.ajax({ url: 'getpage.php?page='+ pageURL }).done(function( retrn ){ $('#loading').hide(0); if(retrn == 'fail'){ alert('Failed to request page.'); }else{ alert(retrn); $('#content').html(retrn); } }); } }); </script> </head> <body> <div id="loading" style="display:none;"> <b><font size="4">Your request is loading...</font></b> </div> <div id="content"> </div> </body> </html> As you can see, it calls this page upon loading: <?php $url = (!isset($_GET['page']) || empty($_GET['page'])) ? 'http://www.youtube.com' : $_GET['page']; //initiate $ch = curl_init(); //set cURL data curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //execute & close $page = curl_exec($ch); curl_close($ch); echo $page; ?> applesauce But for some reason, it doesn't seem to grab the data from the $page variable that the PHP code echoes out. It only returns applesauce. Quote Link to comment https://forums.phpfreaks.com/topic/274751-curl-jquery-ajax/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.