PHP - Curl Show Progress ?
Hi there i'm using php&curl to fetch some data from another site, this sometimes takes up to 30 seconds but you don't actually see anything happen on the screen, i tried to implement the cURL progressbar but i didn't really get it to work, can someone help me out here ?
This is my code: Code: [Select] <?php if(!empty($_SESSION[$session_prefix."user"])) { //Functions function middlestring($string,$start,$stop){ $pos = strpos($string,$start)+strlen($start); $retstr = substr($string,$pos); $pos = strpos($retstr,$stop); $retstr = substr($retstr,0,$pos); return $retstr; } function curl_get($url, $head, $cook, $ssl){ $ch = curl_init($url); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,$ssl); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,$ssl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, $head); if($cook == 1) curl_setopt($ch, CURLOPT_COOKIE, $_SESSION["cookies"]); return curl_exec($ch); } function curl_post($url, $datas, $cook, $ssl){ $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS, $datas); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"); if($cook == 1) curl_setopt($ch, CURLOPT_COOKIE, $_SESSION["cookies"]); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,$ssl); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,$ssl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 1); return curl_exec($ch); } function getcookies($text, $startstr, $endstr){ $start = strpos($text, $startstr); $end = strpos($text, $endstr); $parts = split("Set-Cookie: ",substr($text, $start, $end-$start)); $cookies = ''; foreach ($parts as $co) { $cd = split(";",$co); if (!empty($cd[0])) { if(strpos($cd[0], "deleted")) {} else $cookies .= $cd[0].';'; } } return $cookies; } $mail = $ukuser; $pass = $ukpw; $code = $_REQUEST["code"]; $wert = $_REQUEST["guthaben"]; $captcha = $_REQUEST["captcha"]; if(empty($captcha)) { $text = curl_get('http://www.ukash.com/global/en/login.aspx', 1, 0, 1); $_SESSION["viewstate"] = urlencode(middlestring($text, '__VIEWSTATE" value="', '" />')); $text = curl_post('http://www.ukash.com/global/en/login.aspx', '__EVENTTARGET=ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginCentral_10%24loginButton&__EVENTARGUMENT=&__VIEWSTATE='.$_SESSION["viewstate"].'&sIFR_replacement_0=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginCentral_10%24txtEmail='.$mail.'&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginCentral_10%24txtPassword='.$pass.'&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginRegForm_11%24txtR1FirstName=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginRegForm_11%24txtR1LastName=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginRegForm_11%24txtR1Email=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginRegForm_11%24ddlDOBday=01&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginRegForm_11%24ddlDOBmonth=01&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginRegForm_11%24ddlDOByear=1980&%23=%2Fservices%2FlocaleRedirector.aspx%3FnodeId%3D156095%26languageCode%3Den&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpSideHolder%24sideRegisterLogin_15%24txtR1FirstName=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpSideHolder%24sideRegisterLogin_15%24txtR1LastName=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpSideHolder%24sideRegisterLogin_15%24txtR1Email=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpSideHolder%24sideRegisterLogin_15%24ddlDOBday=01&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpSideHolder%24sideRegisterLogin_15%24ddlDOBmonth=01&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpSideHolder%24sideRegisterLogin_15%24ddlDOByear=1980&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24footerTellAFriend_23%24txtStFemail=&__SCROLLPOSITIONX=0&__SCROLLPOSITIONY=0', 0, 1); $_SESSION["cookies"] = getcookies($text, 'Set-Cookie:', 'Cache-Control: '); $text = curl_get('http://www.ukash.com/global/en/my-ukash.aspx', 1, 1, 1); if(strpos($text, 'My Used Codes')) { $text = curl_get('https://direct.ukash.com/de/tools/combine/logic/step1.aspx?email=&culture=de&country=de&lang=de', 1, 1, 0); $_SESSION["cookies"] .= 'ASP.NET_SessionId='.middlestring($text, 'Set-Cookie: ASP.NET_SessionId=', ' path=/; HttpOnly'); $_SESSION["event"] = urlencode(middlestring($text, 'EVENTVALIDATION" value="', '" />')); $_SESSION["viewstate"] = urlencode(middlestring($text, 'VIEWSTATE" value="', '" />')); $text = curl_get('https://direct.ukash.com/de/tools/combine/utils/PhishingImage.aspx', 0, 1, 0); echo '<form action="" method="post"> <table id="items"> <tr><td>'.$uka1lng.'</td><td><input type="text" name="code"></td></tr> <tr><td>'.$uka2lng.'</td><td><input type="text" name="guthaben" value="20" readonly="readonly"></td></tr> <tr><td><img src="data:image/jpg;base64,'.base64_encode($text).'"></td><td><input type="text" name="captcha"></td></tr> <tr><td></td><td><input type="submit" value="'.$uka3lng.'"></td></tr> </table> </form><br> <font color="red">'.$uka4lng.'</font>'.$uka5lng.'<br>'.$uka6lng; } else $ukerror = $uka7lng; } else { if($wert < 10) $ukerror = $uka8lng; else { $text = curl_post('https://direct.ukash.com/de/tools/combine/logic/step1.aspx', '__VIEWSTATE='.$_SESSION["viewstate"].'&__EVENTVALIDATION='.$_SESSION["event"].'&tbxVoucherNo1='.$code.'&tbxVoucherVal1='.$wert.'&tbxVoucherNo2='.$code.'&tbxVoucherVal2=0&tbxVoucherNo3=&tbxVoucherVal3=&tbxVoucherNo4=&tbxVoucherVal4=&tbxVoucherNo5=&tbxVoucherVal5=&tbxVoucherNo6=&tbxVoucherVal6=&tbxVoucherNo7=&tbxVoucherVal7=&tbxVoucherNo8=&tbxVoucherVal8=&tbxVoucherNo9=&tbxVoucherVal9=&tbxVoucherNo10=&tbxVoucherVal10=&tbxBaseCurrency=EUR&tbxVerContent='.$captcha.'&chkTerms=on&btnConsolidate=', 1, 0); if(strpos($text, 'stimmt nicht mit dem Systemcode')) $ukerror = $uka9lng; else { $text = curl_get('https://direct.ukash.com/de/tools/combine/logic/step2.aspx?lang=de', 1, 1, 0); $_SESSION["viewstate"] = urlencode(middlestring($text, 'VIEWSTATE" value="', '" />')); $_SESSION["event"] = urlencode(middlestring($text, 'EVENTVALIDATION" value="', '" />')); if(strpos($text, 'Ihre Ukash Referenznummer')) { $text = curl_post('https://direct.ukash.com/de/tools/combine/logic/step2.aspx?lang=de', '__VIEWSTATE='.$_SESSION["viewstate"].'&__EVENTVALIDATION='.$_SESSION["event"].'&btnProceed=', 1, 0); $text = curl_get('https://direct.ukash.com/de/tools/combine/logic/Step4.aspx', 1, 1, 0); $newukash = middlestring($text, 'span id="lblVoucherDetailValue"', '</table>'); $newukash = middlestring($newukash, '<tr><td>', '</td></tr>'); $newukash = split('</td><td>', $newukash); $newcode = $newukash[0]; $ukguthaben = $newukash[2]; $user = mysql_fetch_array(mysql_query('SELECT * FROM users WHERE username="'.$_SESSION[$session_prefix."user"].'"')); $geld = floor($user["guthaben"] + $ukguthaben); mysql_query('UPDATE users SET guthaben="'.$geld.'" WHERE username="'.$_SESSION[$session_prefix."user"].'"'); mysql_query('INSERT into ukash (user, code1, code2, value) VALUES ("'.$_SESSION[$session_prefix."user"].'", '.$newcode.', 0, '.$ukguthaben.')'); echo floor($ukguthaben).' '.$guthaben.$uka10lng; } else $ukerror = $uka11lng; } } } echo $ukerror; } else echo'<font color="red">'.$uka12lng.'</font>'; ?> Similar Tutorialsgood day dear community, i am workin on a Curl loop to fetch multiple pages: i have some examples - and a question: Example: If we want to get information from 3 sites with CURL we can do it like so: $list[1] = "http://www.example1.com"; $list[2] = "ftp://example.com"; $list[3] = "http://www.example2.com"; After creating the list of links we should initialize the cURL multi handle and adding the cURL handles. $curlHandle = curl_multi_init(); for ($i = 1;$i <= 3; $i++) $curl[$i] = addHandle($curlHandle,$list[$i]); Now we should execute the cURL multi handle retrive the content from the sub handles that we added to the cURL multi handle. ExecHandle($curlHandle); for ($i = 1;$i <= 3; $i++) { $text[$i] = curl_multi_getcontent ($curl[$i]); echo $text[$i]; } In the end we should release the handles from the cURL multi handle by calling curl_multi_remove_handle and close the cURL multi handle! If we want to another Fetch of sites with cURL-Multi - since this is the most pretty way to do it! Well I am not sure bout the string concatenation. How to do it - Note I want to fetch several hundred pages: see the some details for this target-server sites - /(I have to create a loop over several hundred sites). * siteone.example/?show_subsite=9009 * siteone.example/?show_subsite=9742 * siteone.example/?show_subsite=9871 .... and so on and so forth Question: How to appy this loop into the array of the curl-multi? <?php /************************************\ * Multi interface in PHP with curl * * Requires PHP 5.0, Apache 2.0 and * * Curl * ************************************* * Writen By Cyborg 19671897 * * Bugfixed by Jeremy Ellman * \***********************************/ $urls = array( "siteone", "sitetwo", "sitethree" ); $mh = curl_multi_init(); foreach ($urls as $i => $url) { $conn[$i]=curl_init($url); curl_setopt($conn[$i],CURLOPT_RETURNTRANSFER,1);//return data as string curl_setopt($conn[$i],CURLOPT_FOLLOWLOCATION,1);//follow redirects curl_setopt($conn[$i],CURLOPT_MAXREDIRS,2);//maximum redirects curl_setopt($conn[$i],CURLOPT_CONNECTTIMEOUT,10);//timeout curl_multi_add_handle ($mh,$conn[$i]); } do { $n=curl_multi_exec($mh,$active); } while ($active); foreach ($urls as $i => $url) { $res[$i]=curl_multi_getcontent($conn[$i]); curl_multi_remove_handle($mh,$conn[$i]); curl_close($conn[$i]); } curl_multi_close($mh); print_r($res); ?> I look forward to your ideas. Hey all, Not sure if this is in the correct place (sorry if it is not) But i have been looking for hours now for a simple progress bar system when uploading bigger files. Im not even looking for good looking loading bar a simple percent would be good for me. But every site i have looked at to get any help or ideas from the comments are "Does not work", "Error" and that sort of thing. I have even tried many myself and can not get them to work. (at least 5-6) Some even requires the you to install add on programs to your sever - this i can not do as i don't own it. There must be a easy way to solve this problem? Please help Thank you. Eli Hello, I've been trying to create a progress bar for the past 3 days, but I can't get it to work. I've got my own dedicated server with cPanel on it, using cPanel I installed the PECL extension. However, it doesn't respond to anything. The script I'm using is: HTML code: Code: [Select] <form id="uploadform" enctype="multipart/form-data" method="post"> <input id="UPLOAD_IDENTIFIER" name="UPLOAD_IDENTIFIER" type="hidden" value="12345" /> <input id="ulfile" name="ulfile" type="file" /> <input type="submit" value="Upload" /> </form>To request the information I made another page with: <?php print uploadprogress_get_info($_GET['id']); ?> Nothing is returned however, no error, nothing... I'm totally lost! Regards, I was wondering if there is a way to add an progress bar to this script that uploads files to a sql database
<!DOCTYPE html> <head> <title>MySQL file upload</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body> <form action="add_file.php" method="post" enctype="multipart/form-data"> <input type="file" name="uploaded_file"><br> <input type="submit" value="Upload file"> </form> <p> <a href="list_files.php">See all files</a> </p> <p> <a href="search.php">Search Database</a> </p> </body> </html>If so, how would i go about doing that? Hi. how can I control a progress meter/bar to display errors when it failed to reach 100% or on getting to a point? thanks We are trying to get progress bar to place active class on the current page it one based on variable being set on page called "page", also the page is written into the <body class="page"> tag, once it is loading the page.
It is not working as we need can anyone, help us with script below to set progress bar to do prev and next?????
So variable is:
var page = "refundstep1";Body Class tage looks like: <body class="refunStep 1 main-layout">Progress bar is: <div class="tabContent progress-bar hidden-phone"> <div class="step active"> <h2>Step 1: Enter your Pin</h2> </div> <div class="step inactive"> <h2>Step 2: Tell us your address</h2> </div> <div class="step inactive"> <h2>Step 3: Confirm Your Details</h2> </div> </div>Code to actual set the other list next as class="inactive", list passed or compelted as class="active done", Current page as class="active" var progressClass = $('.progress-bar div.step'); $(progressClass).addClass(function(index, activeClass) { var activeClass = 'done'; var activePage = 'active'; alert(page); var currentPage = page; var pageClass = $('body').hasClass(page); console.log(pageClass); if(pageClass === true) { progressClass.addClass(activePage); progressClass.prevAll().addClass(activeClass); //To select all next elements of `.progressClass` element: progressClass.nextAll().addClass(nopageClass); } return nopageClass; }); I have a site where I have an admin panel set up to import an XML data feed into a database, but it's a large import and it takes a lot of time to update. I'm looking to upgrade the admin panel and offer the ability to be able to see the number of records as they're being imported instead of it hanging there until the query is completed. The tough part about a progress bar is obviously you have to know the # of items being imported beforehand, and that varies each time the feed is downloaded. So I'm just trying to get some suggestions from someone who may have written something similar. Thanks in advance! I'm trying to show the progress of executing a python script in PHP with a progress bar. I found a link (https://www.htmlgoodies.com/beyond/php/show-progress-report-for-long-running-php-scripts.html) that uses SSE to send progress updates to the client. In the original code, a loop is used to simulate a long script but in my case I'm trying to execute a python script that takes roughly 50 seconds. index.php
<!DOCTYPE html> process.php
<?php
function send_message($id, $message, $progress) {
echo "id: $id" . PHP_EOL;
ob_flush();
send_message('CLOSE', 'Process complete'); Problem: As you can see in process.php I commented the original code and placed a simple python execution in php. I just want to diplay the progress of the script but it is not doing so. What do I have to do to show the progress of the script? Note: I don't think is relavent but the python script just opens up a batch file. Are there other methods to display the progress bar of a script in php? hello guys, i need a help from u. from past 1 week , i am searching for it. may be it is simple query for you . in my project, i am uploading a file, for example 5mb of audio file, while uploading i need to display a progress bar along with percentage of how much it is uploaded to server ( as it works in google chrome browser). i tried several codes by searching in google . No code is working. i can able to display only loader.gif image not the status bar with percentage. so pls guys if you have these codes, pls share it . Hi,
I've seen this done, and I thought it would be simple now that I am starting to understand ajax but I can't figure it out.
I am using jQuery ajax via wordpress. I can click a button, call a php function and use the value returned from php to populate the textbox.
Ok, great!
but I want to run a rather lengthy procedure, and while it's running I would like it to record it's status in a multi-line text box as sort of a debugger ( and to pass the time while waiting )
How can I accomplish this?
I've googled but I must not be using the correct words to search.
This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=316351.0 Hello people, I have created an application in Code Charge where my site users can login and play games online.The game code is run via flash and html. The Game has 5 stages and from a page in my application called transfertogame.php , i transfer them to the game page. Now i want to be able to track each players progress via database so that when they log back in and they get to the transfertogame.php page, it can check the page they were on before and immediately take them to the page without starting from page 1. Any help will be appreciated as i am very poor with php scripting This is the session ID i guess is being used from my application page //Initialize Method @4-537EA73F function Initialize() { if(!$this->Visible) return; $this->ds->Parameters["sesUserID"] = CCGetSession("UserID"); } //End Initialize Method //Validate Method @4-7E1FC38C function Validate() { $Validation = true; $Where = ""; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate"); return (($this->Errors->Count() == 0) && $Validation); } //End Validate Method Hello All, I am in desperate help here since my site was DDoS attacked by some one in turkey (Ips originate mostly from turkey, Germany, and some other Europe countries). I have installed the ddos deflation and most of the IPs are now blocked. I have a php file in my server that I use to input data into my database and my streaming servers. This file is called connect.php and the hacker is basically created an automated script that repeatedly call the connect.php file from a botnet resulting in both apache and mysql dead. I use connect.php in the following way http.open('get', "ajax/createchannel_1.php?channel=" + channelname + "&sitename=" + sitename + "&privateurl=" + privateurl + "&privateurlcheck=" + privateurlcheck); How can i change the connect.php so that it only accept execution from my server/ Please your help is greatly appreciated. I want to show a cookie of a referral's username on a sign up page. The link is like this, www.mysite.com/signup?ref=johnsmith. The cookie doesn't show if I go to that url page. But it does show up once I reload the page. So I'm wondering if it's possible to show the cookie the first time around, instead of reloading the page? Here is my code. // This is in the header $url_ref_name = (!empty($_GET['ref']) ? $_GET['ref'] : null); if(!empty($url_ref_name)) { $number_of_days = 365; $date_of_expiry = time() + 60 * 60 * 24 * $number_of_days; setcookie( "ref", $url_ref_name, $date_of_expiry,"/"); } else if(empty($url_ref_name)) { if(isset($_COOKIE['ref'])) { $user_cookie = $_COOKIE['ref']; } } else {} // This is for the sign up form if(isset($_COOKIE['ref'])) { $user_cookie = $_COOKIE['ref']; ?> <fieldset> <label>Referred By</label> <div id="ref-one"><span><?php if(!empty($user_cookie)){echo $user_cookie;} ?></span></div> <input type="hidden" name="ref" value="<?php if(!empty($user_cookie)){echo $user_cookie;} ?>" maxlength="20" placeholder="Referrer's username" readonly onfocus="this.removeAttribute('readonly');" /> </fieldset> <?php }
I am displaying rows from a database onto a page using: while($row=mysql_fetch_array($query)){ echo $row['name']; } I need to figure out how to limit the rows shown to the page to 100. And if there are 100 rows on the page, a link will be displayed at the bottom, that says "Next 100". Then this will display the next 100 rows. Can you give an example how to do this please? Thanks Hi , I know my code sucks but i'm learning fast!! I'm trying to show a form if the qty value in a database == 10 or a different form if the value ==20. I tried but failed. Any help really appreciated. Code: [Select] <?php require_once('Connections/book.php'); ?> <?php $colname_cardpayment = "-1"; if (isset($_GET['orderid'])) { $colname_cardpayment = (get_magic_quotes_gpc()) ? $_GET['orderid'] : addslashes($_GET['orderid']); } mysql_select_db($database_book, $book); $query_cardpayment = sprintf("SELECT * FROM cards WHERE orderid = '%s' ORDER BY qty ASC", $colname_cardpayment); $cardpayment = mysql_query($query_cardpayment, $book) or die(mysql_error()); $row_cardpayment = mysql_fetch_assoc($cardpayment); $totalRows_cardpayment = mysql_num_rows($cardpayment); // Database connect $con = mysql_connect("mysql1.myhost.ie","admin_book","root123"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("book_test", $con); //Parse Values from Coupon.php Form $orderid = mysql_real_escape_string(trim($_POST['orderid'])); $name = mysql_real_escape_string(trim($_POST['name'])); $surname = mysql_real_escape_string(trim($_POST['surname'])); $add1 = mysql_real_escape_string(trim($_POST['add1'])); $add2 = mysql_real_escape_string(trim($_POST['add2'])); $town = mysql_real_escape_string(trim($_POST['town'])); $county = mysql_real_escape_string(trim($_POST['county'])); $postcode = mysql_real_escape_string(trim($_POST['postcode'])); $phone = mysql_real_escape_string(trim($_POST['phone'])); $email = mysql_real_escape_string(trim($_POST['email'])); $letterstyle = mysql_real_escape_string(trim($_POST['letterstyle'])); $sql="INSERT INTO custdetails (orderid, name, surname, add1, add2, town, county, postcode, phone, email, letterstyle) VALUES ('$orderid','$name','$surname','$add1','$add2','$town','$county','$postcode','phone','$email','$letterstyle')"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Digital Scribe Books</title> <link href="style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } </script> </head> <body onload="MM_preloadImages('images/buttons/home_over.png','images/buttons/books_over.png','images/buttons/cards_over.png','images/buttons/letters_over.png')"> <div id="snow"> <div id="wrapper"> <div id="header"> <div id="logo"><img src="images/digital_scripe.png" width="218" height="91" /></div> <div id="menu"><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','images/buttons/home_over.png',1)"><img src="images/buttons/home_act.png" name="Home" width="131" height="132" border="0" id="Home" /></a><a href="books.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Books','','images/buttons/books_over.png',1)"><img src="images/buttons/books_act.png" name="Books" width="131" height="132" border="0" id="Books" /></a><a href="cards.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Cards','','images/buttons/cards_over.png',1)"><img src="images/buttons/cards_act.png" name="Cards" width="131" height="132" border="0" id="Cards" /></a><a href="letters.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Letters','','images/buttons/letters_over.png',1)"><img src="images/buttons/letters_act.png" name="Letters" width="131" height="132" border="0" id="Letters" /></a></div> </div> <div id="content"> <?php echo 'Order ID is : '. $orderid . '.<br />'; if ($row2['qty'] == 10) echo "<div> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="accounts@agraphics.ie"> <input type="hidden" name="lc" value="IE"> <input type="hidden" name="item_name" value="10 Christmas Cards"> <input type="hidden" name="item_number" value="<? echo $orderid; ?>"> <input type="hidden" name="amount" value="12.99"> <input type="hidden" name="currency_code" value="EUR"> <input type="hidden" name="button_subtype" value="services"> <input type="hidden" name="shipping" value="2.99"> <input type="hidden" name="return" value="http://www.digitalscribe/thanks.php"> <input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted"> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form> </div>"; if ($row2['qty'] == 20) echo "<div> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="accounts@agraphics.ie"> <input type="hidden" name="lc" value="IE"> <input type="hidden" name="item_name" value="20 Christmas Cards"> <input type="hidden" name="item_number" value="<? echo $orderid; ?>"> <input type="hidden" name="amount" value="21.99"> <input type="hidden" name="currency_code" value="EUR"> <input type="hidden" name="button_subtype" value="services"> <input type="hidden" name="shipping" value="2.99"> <input type="hidden" name="return" value="http://www.digitalscribe/thanks.php"> <input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted"> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form> </div>"; ?> </div> <div id="footer" class="clear"><div id="sign"><div id="sign_text">Personalised<br /> Books</div> </div></div> </div></div> </body> </html> <?php mysql_free_result($cardpayment); ?> Hi, I would like to do the following but not sure how. If the you/user is on index.php of http://www.domain.com/ show one page If not show another How would I do this? Thanks Hi, I have server which is posting me these data through curl. $strPost = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; $strPost .= "<request>"; $strPost .= "<type>login</type>"; $strPost .= "<session>21</session>"; $strPost .= "</request>"; $url = "http://www.abc.com/xyz.php"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_HTTPGET,1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml")); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_POSTFIELDS, $strPost); // add POST fields curl_setopt($ch, CURLOPT_POST, 1); $result = curl_exec($ch); if($result == true) { echo $result; } curl_close($ch); I wanna read the above xml send i.e $strPost at http://www.abc.com/xyz.php i m trying to read it with $_POST['strPost'] but shows empty. Can anyone help me. I have a large list of websites that have allowed me to submit my website and description every 24 hours to there sites. I'm really getting tired of sitting by my computer and submitting the information to every site manually. I never understood curl and php dom stuff. does anyone have a easy code where I can post a pre scripted text of my information into three boxes and it auto submits every 24 hours to the websites? The boxes look like this Code: [Select] <input maxlength="255" value="http://" name="sPlugurl" size="20" style="font-family: Verdana; color: FE9999; font-size: 10pt; background-color: 656565; font-weight: none; border: 1px solid #0C0C0C" type="text"> <input maxlength="30" value="Sitename" name="sPlugname" size="20" style="font-family: Verdana; color: FE9999; font-size: 10pt; background-color: 656565; font-weight: none; border: 1px solid #0C0C0C" type="text"> <input maxlength="255" value="Description" name="sPlugdescription" size="20" style="font-family: Verdana; color: FE9999; font-size: 10pt; background-color: 656565; font-weight: none; border: 1px solid #0C0C0C" type="text"> <input type="submit" value="Dump" style="background-color: #656565; font-family: Verdana; color: <? echo ;?>; font-size: 10pt; border: 1px solid #0C0C0C"> the php script would auto fill out the value of the first 3 boxes with my info and then the program would submit it to there forum. I looked on google but nothing I found I can figure out? |