punith Posted January 29, 2014 Share Posted January 29, 2014 (edited) hii'm new to php but i tried to make my own edu website but i'm facing lot of problem bu using phpwhen the students enter their usn no(eg:1db11cs001) when user hit submit button it must fetch result from external website(eg:fastvturesults,vtualerts) and it must display result on my website i'm new to php so plz help me by giving complete codei got this from some website but it's not working properly <?phpecho '<form action="' . $_SERVER[PHP_SELF] . '" method="post"><input type="text" name="rid"><input type="submit" name="submit" value="submit"></form>';if(isset($_POST['submit'])&&(!empty($_…{$location = 'http://results.vtu.ac.in/vitavi.php';$userAgent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)';$ch = curl_init();curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_VERBOSE, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_URL, $location );$post_array = array("rid" => $_POST['rid'],"submit" => "submit");curl_setopt($ch, CURLOPT_POSTFIELDS, $post_array);$response = curl_exec($ch);$start = '<TD width="513">';$end = '<br>';$response = strstr($response, $start);$end = stripos($response, $end);$response = substr($response, strlen($start), $end - strlen($start));echo $response."<br/>";}?> Edited January 29, 2014 by punith Link to comment Share on other sites More sharing options...
thescientist Posted January 29, 2014 Share Posted January 29, 2014 what's the problem? what's happening? what debugging are you doing? How do you know what the code is doing and where it breaks? Link to comment Share on other sites More sharing options...
Don Jajo Posted January 29, 2014 Share Posted January 29, 2014 To be honest, i don't get you :/ Link to comment Share on other sites More sharing options...
punith Posted January 29, 2014 Author Share Posted January 29, 2014 @ thescientist while explainig the problem i hv left out some lines now i've completed it coming to problem topic i haev copied & pasted the code on online php complier (http://phpfiddle.org/) when i enter usn no/roll no(eg:1db13cs005) its just showing the student name but i need the complete result copy to be displayed on my website Link to comment Share on other sites More sharing options...
thescientist Posted January 30, 2014 Share Posted January 30, 2014 (edited) what's your updated code? What exactly are you getting for a response? It's hard to help you without seeing what you're doing. debug everything, especially $response. I would personally proxy curl through your localhost and using something like Charles Web Proxy to monitor the request and response so you can see exactly what is going on. Edited January 30, 2014 by thescientist Link to comment Share on other sites More sharing options...
Don Jajo Posted January 30, 2014 Share Posted January 30, 2014 Hello, I wanna ask, the page that gives out the details, which input type does it accept? POST or GET? Link to comment Share on other sites More sharing options...
punith Posted January 30, 2014 Author Share Posted January 30, 2014 @ the scientist & Don jojo plz follow this link http://stackoverflow.com/questions/13899643/to-fetch-the-form-results-from-an-external-website-on-the-same-page Link to comment Share on other sites More sharing options...
punith Posted January 31, 2014 Author Share Posted January 31, 2014 @Don jojo its post method Link to comment Share on other sites More sharing options...
Don Jajo Posted January 31, 2014 Share Posted January 31, 2014 Okay, sorry for much questions. You need to get the page that loads the info but still on your site? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now