I have a scirpt that was made by Documaker, he is a very helpful person and kind. Its a script that passes keywords through ebay using a post data function <?php if (isset($_POST['submit'])) { header('Location: http://shop.ebay.com/?_from=R40&_npmv=3&_trksid=p3910.m38.l1313&_nkw='.$_POST["MyQuery"].'&_sacat=See-All-Categories'); } ?> <form method="post" action="<?php echo $PHP_SELF;?>"> Search For: <input type="text" size="12" maxlength="12" name="MyQuery"><br /> <input type='submit' name='submit'><br /> </form> This was made by Documaker Not me. Instead of passing the keyword through Ebay and displaying it on the ebay page, i want it to pass the keyword through ebay, but then display it on My webpage, Formatting and other stuff will be considered later, on but now i just want it to display the results. Thanks for any help. Thanks in Advance, and please dont say people wont help you, as they're are kind people on DP.
What will have to happen is: Create a curl handle. Input the url into the handle, as well as the variables. Have it return the curl handle (giving you data) -insert formatting / parsing steps- Then display it to the browser.
<?php if(!isset($_POST['submit']))die(); // Die if no data is POSTed $search = $_POST["MyQuery"]; // Define the $search variable $ch = curl_init(); // Start curl session curl_setopt($ch, CURLOPT_URL, "http://shop.ebay.com/?_from=R40&_npmv=3&_trksid=p3910.m38.l1313&_nkw=".$search."&_sacat=See-All-Categories"); // URL to visit curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // true = return the transfer into a string $res = curl_exec($ch); // Execute curl session and create the variable curl_close($ch); // Closes curl session echo $res; // Echoes the string ?> PHP: Should help you to do the trick, you could also use (in case you're lacking curl) <?php if(!isset($_POST['submit']))die(); // Die if no data is POSTed $search = $_POST["MyQuery"]; // Define the $search variable $url = file_get_contents("http://shop.ebay.com/?_from=R40&_npmv=3&_trksid=p3910.m38.l1313&_nkw=".$search."&_sacat=See-All-Categories"); // Load the resource into a string echo $url; // Output the content ?> PHP:
form.html <form method="post" action="curl.php"> Search For: <input type="text" size="12" maxlength="12" name="MyQuery"><br /> <input type='submit' name='submit'><br /> </form> PHP: curl.php <?php if(!isset($_POST['submit']))die(); // Die if no data is POSTed $search = $_POST["MyQuery"]; // Define the $search variable $ch = curl_init(); // Start curl session curl_setopt($ch, CURLOPT_URL, "http://shop.ebay.com/?_from=R40&_npmv=3&_trksid=p3910.m38.l1313&_nkw=".$search."&_sacat=See-All-Categories"); // URL to visit curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // true = return the transfer into a string $res = curl_exec($ch); // Execute curl session and create the variable curl_close($ch); // Closes curl session echo $res; // Echoes the string ?> PHP: Client POSTs MyQuery to curl.php, which processes the whole stuff and finally prints everything back to user What else would you like to do?
<?php $url = file_get_contents("http://shop.ebay.com/?_from=R40&_npmv=3&_trksid=p3910.m38.l1313&_nkw=phones&_sacat=See-All-Categories"); $exp = explode("<div id=\"v4-35\">",$url); $pos = strpos($exp[1],"<div class=\"compare\" id=\"v4-39\">"); $sub = substr($exp[1],0,$pos); echo $sub; ?> PHP: Gets the contents of the products div.