Search the Community
Showing results for tags 'curl'.
-
Hey Guys, I'm just starting to learn Curl so that I connect to an API. At the moment I have this php code: <?php //******************************************************************************// // // //THIS FILE TAKES A CURRENT JOB AND ADDS IT TO A PAL LABEL PROJECT // // // //******************************************************************************// // ******* TURN ON ERROR REPORTING *****// error_reporting(E_ALL); ini_set('display_errors', '1'); //**** SET THE HEADERS UP FOR AUTHENTICATION *****// $headers = array(); $headers[] = "X-SUBDOMAIN:XXXXXXXXXXX"; // Set the sub domain $headers[] = "X-AUTH-TOKEN:XXXXXXXXXX"; // Set the API Code $headers[] = "application/json"; $total = 50; // this is the max number of pages we will search. with 100 items on a page, and 100 items that means we can return 10,000 items $curl = curl_init(); //**** WE GET ALL OF THE ITEMS CURRENTLY IN THE CURRENT PROJECT AND PUT THEIR UNIQUE ID INTO THE ASSETS ARRAY ***// curl_setopt($curl, CURLOPT_RETURNTRANSFER,true); curl_setopt($curl, CURLOPT_URL, 'https://api.current-rms.com/api/v1/products?page=1&per_page=100'); // allows up to 1 million products curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); // Send the request & save response to $resp $resp = curl_exec($curl); // Convert the response to an array $obj = json_decode($resp, true); // The Obj array currently contains every item in the DB and loads of useless info. We need to extract just the ID and the Name! If I print_r the $obj variable it returns this: I have cut the output down a bit, each item in the products array is about 50 lines long, The only information I actually need to recall is the first two lines which is [id] and the [name]. Is there a simple way that I can do this? So far I have tried to do a Foreach loop and create a new array, but this take a very long time (there are about 600 records!) there must be a much simpler way, where I can unset everything that I don't need, or only call the information that I need from the API? Here is the foreach loop that I used: foreach ($obj as $key) { foreach ($key as $id => $value) { if (!empty($value['name'])) { $products[] = array('Name'=>$value['name'], 'ID' => $value['id'] ); } } } **EDIT ** Once I have my array of ID's (which will be around 600 values long) I then need to get a list of serial numbers that are linked to these id's (there could be up to 100 per id) which will leave me with an array that will be huge! So far I have been getting gateway 504 error's, which I'm hoping is just due to the fact that I'm currently pulling out so much more information than I actually need, so I'm trying to make this more efficient and slim lined. I'm fairly new to PHP, and just do it as a hobby, so go easy on me please! Thanks AJLX
-
I have never used cURL before and have hit a roadblock in my learning. I am trying to make a HTTP GET request to my Wowza server which uses the Rest API to return JSON results. I have authentication set to none on the server at the moment until I can get the script working. I have tested the code below with an external website and it works but, when I try to use it with the URL from the server with the Rest API it just times out. I can make the request in a browser fine, just not from the code. What am I missing or not doing correctly? $ch = curl_init("http://IP_TO_SERVER:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/incomingstreams/ncopeland"); // such as http://example.com/example.xml curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, 0); $data = curl_exec($ch); curl_close($ch); print $data; The response should be this. { "serverName": "_defaultServer_", "sourceIp": "ncopeland", "isPTZEnabled": false, "applicationInstance": "_definst_", "name": "ncopeland", "isRecordingSet": false, "isStreamManagerStream": true, "isPublishedToVOD": false, "isConnected": true, "ptzPollingInterval": 2000 } -Thanks!
-
Hi, I have a PHP script using the cURL function. This script send the data by a web service. It works often without problem. Sometimes, he sent a double data : same data by two times. I checked the log file this script (by curl_getinfo) on "total_time" When this script works correctly (it send the data only one time) : the total_time is less than 6 second. but when the total_time is more than 7 second, (this is a casual/occasional situation), my script send same data by two times so it is double data! So the web service send the ACK(Acknowledgment) which takes a long time (more than 7 second) and then, the TCP send again same data to a web service. How can I avoid this doubling ? By increasing this time waiting / time limit ? How can I define this time limit for 12 second? Could you help me : Thanks
-
Hi guys, I wanted to make a script login to the website Marktplaats.nl, but it doesn't seem to work.. At the moment I can't post the code as it's on my laptop. Does anyone know how to login and maybe do other stuff on Marktplaats.nl with cURL? Kind regards, Kevin Ruhl.
-
Hello everybody I;m trying to post data to my facbook page (not on my profile wall) but whenever i try it keeps getting posted in my fan page but in different place . I want to post it using My Page name i the wall but it is getting posted in this section (in the left panel of my page..) I want to show in the page wall like all the posts is showing... Here is the script that i've used $touid = "xxxxxxxxxxxxxxxxx"; // This is the page id i'm using $token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // my access token of that page $msg = "Hello again"; $title = "TItle"; $uri = "http://www.google.com"; $desc = "description"; $pic = "http://i.imgur.com/JCdGh.png"; $action_name = "Google"; $action_link = "http://www.google.com"; echo FB_wallpost_wosdk($touid, $token, $msg, $title, $uri, $desc, $pic, $action_name, $action_link); function FB_wallpost_wosdk($touid, $token, $msg, $title, $uri, $desc, $pic, $action_name, $action_link){ if ( ($touid !="") && ($token !="") && ($msg != "") && ($title != "") && ($uri != "") && ($desc != "") && ($pic != "") && ($action_name != "") && ($action_link != "") ) { $url = "https://graph.facebook.com/".$touid."/feed"; $attachment = array( 'access_token' => $token, 'message' => $msg, 'name' => $title, 'link' => $uri, 'description' => $desc, 'picture'=>$pic, 'actions' => json_encode(array('name' => $action_name,'link' => $action_link)) ); // set the target url $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //to suppress the curl output $result = curl_exec($ch); curl_close ($ch); return $result; } else { return 0; } } My Access tokens have this scopes.. Whenever i post anything it getting posted as a visitors post in my fan page.... Pleas help guys... THank in advance....
-
Hi, I'm using the following code to grab a csv file from one website & keep it on my website. The code is working fine. <?php $url = 'http://thewebsite.com/export.aspx?type=csv&report=nameofthereport~8~'; $path = '/home/path/to/mywebsite.com/public_ftp/incoming/nameofthereport_Area_8.csv'; $fp = fopen($path, 'w'); $ch = curl_init($url); curl_setopt($ch, CURLOPT_FILE, $fp); $data = curl_exec($ch); curl_close($ch); fclose($fp); ?> Here's what I want to do next. I want to query a database, and replace nameofthereport and 8 with the results of the query. My code to query the database is below. <?php include("/home/path/to/mywebsite.com/public_html/db_connect.php"); //connect to the database $today = date('Y-m-d'); $query1=("SELECT * FROM `table_name` WHERE expiry > $today"); $result1=mysqli_query($GLOBALS["___mysqli_ston"], $query1); $num1=mysqli_num_rows($result1); if ($num1 > 0) { while ($data = mysqli_fetch_array($result1)){ $email_to = $data["email"]; $district = $data["district"]; $report = $data["report"]; } } ?> Based on the code above, I would like to replace nameofthereport with $report and 8 with $district Could you show me the code please? Thanks.
-
I've been puzzling over this for a few days now, and the Siteground L2 support isn't willing to help out here. I'm coding a Wordpress plugin to get affiliate tracking links from Tune/HasOffers. This is totally acceptable behavior AFAIK, and all I have to do is call a URL, and I'll be redirected to a landing page with whatever parm values I've specified. I have a development Linode, where this script works as expected. You can see the output here: http://new.burtlo.info/wp-content/plugins/lmpostback/test.php I've installed that same script on Siteground, but I get a zero length response: http://launchmoxie.com/wp-content/plugins/lmpostback/test.php I've tried a number of variations on making the call, and have tried a number of curl options as well. I'm still stuck. Any suggestions? Thanks in advance. Here's the code: <?php $aff_link = 'http://jump.launchmoxie.com/aff_c?offer_id=26&aff_id=793'; // create a new cURL resource $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, $aff_link); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); // grab URL and pass it to the browser $response = curl_exec($ch); print_r ($response); echo 'strlen of response = ' . strlen($response); // close cURL resource, and free up system resources curl_close($ch); ?>
-
I need to send a cURL request containing a file to upload as well as a JSON string. I can get a properly formatted request when sending the JSON, but the file is throwing it off. $curl_file_object = '@'.$tmp_name $postData= array( 'JSON'=> json_encode($jsonParams), $reference => $curl_file_object, ); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $target); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // stop verifying certificate curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, true); curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: multipart/form-data;")); curl_setopt($curl, CURLOPT_POST, true); // enable posting curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); // post data curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); // if any redirection after upload $response = curl_exec($curl); $info = curl_getinfo($curl); curl_close($curl); debug($info); Am I the first one needing to send file binary data along with a json string to a server at the same time?
-
I have two domains - http://domaina.com, http://domainb.com I'm calling domainb.com's url from domaina.com: file_get_contents('http://domainb.com/a.php'); In http://domainb.com/a.php, I'm trying to creating a session or cookie for domainb.com <?php setcookie("key", "value", time()+3600); session_start(); $_session["key1"] = "value1"; ?> But this code is not working. Please help in solving this issue. Thank you.
- 2 replies
-
- curl
- file_get_contents
-
(and 2 more)
Tagged with:
-
hi everyone, thanks in advance. i have one issue regarding cookie based authentication with curl. i have an application which calls a third party php url for user registration and authentication. when we called athentication with third party url using curl the result shows succes and cookie is building. again i need to call another url from same third party server which displays a flash. once the authentication is success the flash automatically logins. but for me flash ask for username and password, it should n't be like that. i hope my curl call not building cookie in right format. please check my code and give suggestions. <?php $result=$name=$pass=""; $name= $_SESSION["name"]; $pass=$_SESSION["pass"]; $ch = curl_init(); $cookie_file_path = 'my_cookie.txt'; $cookie_file_path = realpath($cookie_file_path); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path); curl_setopt($ch, CURLOPT_VERBOSE, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); //new ones curl_setopt($ch, CURLOPT_HEADER, 1); // here i am calling third party url for athentication curl_setopt($ch, CURLOPT_URL,"http://thirdpartyserver.com/checksession.php?username=".$name."&passme=".$pass); $result= curl_exec ($ch); if ($result==true) { //here i am calling the third party flash which is embed in this page. flash should automatically login with cookie. header( "refresh:1;url= http://myserver/testfolder/flashLoader.php" ); } ?> please let me my code is correct, and thanks for your suggestions. thanks vinz
-
I'm using multiple API's, all of which get called using cURL. Someone on Reddit recommended code that looks like this: function fetch($url, $the_id = null) { // Initiate the cURL fetch $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Send authorization header with the the ID. Without this, the query won't work if ($the_id) curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: '.$the_id)); $result = curl_exec($ch); curl_close($ch); // Put the results to an object return simplexml_load_string($result) or die("Error: Cannot create object"); } // Without auth id $test = fetch('http://forums.phpfreaks.com'); // With auth id $test = fetch('http://forums.phpfreaks.com', 't_v'); But when I then use the foreach to pull the data from the API, it produces no results. foreach($result->things->children() as $thing) { echo "<p>". $thing->cool_thing ."</p>"; echo "<p>". $thing->cooler_thing ."</p>"; } Whether I use echo fetch(parameters); or fetch(); it does get any results, unlike if I used it outside of a function.
-
Hello, I want to download flight from Wizzair page. I've checked all headers which are sended when browser "create" request (the same which Ryanair few months ago). It looks like this in my browser: I'm entering at https://wizzair.com/pl-PL/Search, select everything (from-to, date arrival and departure) then click "Send" and I've got results. I've checked headers and I can see, that theres two requests to the following pages: 1) Search (here is created session ID saved in cookie, i've also sent POST parameters here), it returns error 302 then redirect to: 2) Select (theres no any post or get parameters, just requested session ID created before) and return results with flights. I was trying to achieve the same results by curl. I created curl request with the same POST parameters to Search page. I save sessionId to cookie, also create the same cookies as in browser. Then enter to Select page, use cookies saved before but nothing happens. First request return 302 error (the same happen in brower) Second request returns default Wizzair website without flight results If I use sessionId generated in my browser (not from curl request), second request show me correct results. Why it doesn't work in curl? Is there any request processed and saved JavaScript which is not processed by curl method? Code from my first requst where i'm sending post parameters in request $fields = array( 'cookiePolicyDismissed' => 'true', '__EVENTTARGET' => 'HeaderControlGroupRibbonSelectView_AvailabilitySearchInputRibbonSelectView_ButtonSubmit', '__VIEWSTATE' => '/wEPDwUBMGQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgEFXEhlYWRlckNvbnRyb2xHcm91cFJpYmJvblNlbGVjdFZpZXckQXZhaWxhYmlsaXR5U2VhcmNoSW5wdXRSaWJib25TZWxlY3RWaWV3JFN0dWRldFNlbmlvckdyb3VwwAw35gayQedhYJ8oz+CHlR8x2gWGvNOEfHfCOBjF/lk=', 'cff49415-63b6-4d31-b273-5eab61b6c327' => 'e2df7ef6-3abf-4eab-8110-51c30f30109a', 'HeaderControlGroupRibbonSelectView%24AvailabilitySearchInputRibbonSelectView%24OriginStation' => $from, 'HeaderControlGroupRibbonSelectView%24AvailabilitySearchInputRibbonSelectView%24DestinationStation' => $to, 'HeaderControlGroupRibbonSelectView%24AvailabilitySearchInputRibbonSelectView%24DepartureDate' => $dateStart, 'HeaderControlGroupRibbonSelectView%24AvailabilitySearchInputRibbonSelectView%24ReturnDate' => $dateBack, 'HeaderControlGroupRibbonSelectView%24AvailabilitySearchInputRibbonSelectView%24PaxCountADT' => '1', 'HeaderControlGroupRibbonSelectView%24AvailabilitySearchInputRibbonSelectView%24PaxCountCHD' => '0', 'HeaderControlGroupRibbonSelectView%24AvailabilitySearchInputRibbonSelectView%24PaxCountINFANT' => '0', 'WizzSummaryDisplaySelectViewRibbonSelectView%24PaymentCurrencySelector' => '00000000-0000-0000-0000-000000000000FULL', 'HeaderControlGroupRibbonSelectView%24AvailabilitySearchInputRibbonSelectView%24ButtonSubmit' => 'Szukaj'); //url-ify the data for the POST foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string,'&'); //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0'); curl_setopt($ch, CURLOPT_HEADER,1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE_FILE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Host: wizzair.com', 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/*;q=0.8', 'Accept-Language: pl,en;q=0.7,en-us;q=0.3', 'Connection: keep-alive' )); curl_setopt($ch,CURLOPT_POST,count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); //execute post $result = curl_exec($ch); curl_close($ch);
-
I have this code and its downloading file nicely. But I want to show a progress bar while downloading file from external server. My existing code shows progress bar but its not effective (ex. if i try to download two media file, one video and another audio, and video size is larger than audio size the audio finishes first and the progress bar shows 100% also suddenly it drops to 50% as the video is still downloading ). I mean it actually shows two progress and I need one. If I could get average percentage value of two progress that would be better. Any suggestion regarding this will be greatly appreciated. <?php set_time_limit ( 0 ); function define_progress_callback($i) { global $conn; curl_setopt($conn[$i], CURLOPT_PROGRESSFUNCTION, function ($resource,$download_size, $downloaded, $upload_size, $uploaded) { if($download_size > 0) $progress = round($downloaded / $download_size * 100); echo '<script language="javascript">$(".loader").loader("setProgress", '.$progress.');</script>'; echo str_pad("",1024," "); flush(); usleep(20000); }); } $urls = array("http://example.com/file.mp3", "http:/example.com/file.mp4"); $save_to='./tmp/'; $conn = array(); $fp = array(); $mh = curl_multi_init(); foreach ($urls as $i => $url) { $g = $save_to . basename($url); $conn[$i]=curl_init($url); $fp[$i]=fopen ($g, "wb"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // No certificate curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt ($conn[$i], CURLOPT_FILE, $fp[$i]); curl_setopt ($conn[$i], CURLOPT_HEADER ,0); curl_setopt($conn[$i],CURLOPT_CONNECTTIMEOUT,60); curl_setopt ($conn[$i], CURLOPT_MAXCONNECTS, 10); curl_setopt($conn[$i], CURLOPT_NOPROGRESS, false); define_progress_callback($i); curl_multi_add_handle ($mh,$conn[$i]); } do { $n=curl_multi_exec($mh,$active); } while ($active); foreach ($urls as $i => $url) { curl_multi_remove_handle($mh,$conn[$i]); curl_close($conn[$i]); fclose($fp[$i]); } curl_multi_close($mh); ?>
-
Hey guys i need help with a CURL code. I need to retreive all the data in a table located at http://www.listenlive.nl/tvgenre.php?g=1&page=0 and parse the data to finish with an array that looks like this: $row[0][station_name] = '3BTV'; $row[0][stream_link] = '420'; $row[0][stream_type] = 'wma'; $row[0][country] = 'United Kingdom'; $row[0][genre][0] = 'Variety'; $row[0][genre][1] = 'Alternative'; $row[0][genre][2] = 'Culture'; $row[0][rating] = '1/5'; I need that for each rows of the table where the first array number would increment $row[1], $row[2] ... My PHP code is incomplete. I currently have a loop for all the TR's of the page ... and when i loop all the TD's inside the TR's it returns a load of crap ... I am unsure where to go from here. Any help would be apreciated thx This is my code: $ch = curl_init(); $categ[url] = 'http://www.listenlive.nl/tvgenre.php?g=1&page=0'; curl_setopt($ch, CURLOPT_URL, $categ[url]); curl_setopt($ch, CURLOPT_POST, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies); curl_setopt($ch, CURLOPT_COOKIE, $cookies); curl_setopt($ch, CURLOPT_REFERER, $categ[url]); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_USERAGENT, $nav); $data2 = curl_exec($ch); $dom2 = new DOMDocument(); libxml_use_internal_errors(true); $dom2->loadHTML($data2); $trs = $dom2->getElementsByTagName('tr'); foreach ($trs as $tr) { echo "<pre>"; print_r($tr); echo "</pre>"; }
-
Hi! I'm trying to make an button that when it's pressed sends an http post to my home server. But my home server is runing on port 84 and i think that i'm not being able to send the post correctly because of this port. any help? my code now is this: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://homeserver.net:84/?device=35"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); The way I have the URL is correct? thanks!
-
I am trying to create a remote login to one website using mine. The users will need to enter their username and password on my site, and if they are registered to my website, their login credentials will be sent to another website and a page will be retrieved. I am stuck at sending the users' data to the original site. The original site's viewsource is this.. <form method=post> <input type="hidden" name="action" value="logon"> <table border=0> <tr> <td>Username:</td> <td><input name="username" type="text" size=30></td> </tr> <tr> <td>Password:</td> <td><input name="password" type="password" size=30></td> </tr> <td></td> <td align="left"><input type=submit value="Sign In"></td> </tr> <tr> <td align="center" colspan=2><font size=-1>Don't have an Account ?</font> <a href="?action=newuser"><font size=-1 color="#0000EE">Sign UP Now !</font></a></td> </tr> </table> I have tried this code, but not works. <?php $username="username"; $password="password"; $url="http://www.example.com/index.php"; $postdata = "username=".$username."&password=".$password; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); curl_setopt ($ch, CURLOPT_TIMEOUT, 60); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_REFERER, $url); curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata); curl_setopt ($ch, CURLOPT_POST, 1); $result = curl_exec ($ch); header('Location: track.html'); //echo $result; curl_close($ch); ?> Any help would be appreciated, Thanks in advance.
-
Hello , I'm here with a problem facing with automatic login , I'm not able to login programmatically and fill the forms programatically to other website . here is the code which i have tried . <?php $url="http://gis.lntecc.com/bwssblnt/Scada.aspx?field1=Kathriguppe%2cSW2DM0402%2c235505H073%2c450"; $ch=curl_init(); $headers = array( 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Encoding: gzip,deflate,sdch', 'Accept-Language: en-GB,en-US;q=0.8,en;q=0.6', 'User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36' ); $cookie='/cookie.txt'; $curl_data = "Login1\$UserName=abc&Login1\$Password=123"; //&__VIEWSTATE=>/wEPDwUJMzE2NDc5ODU3ZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18WAgURTG9naW4xJFJlbWVtYmVyTWUFF0xvZ2luMSRMb2dpbkltYWdlQnV0dG9ukK3V3IzBCYqop9/bJLrN4/gCDUo='; //var_dump($curl_data); $options = array( CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_ENCODING => "", // handle all encodings CURLOPT_USERAGENT => "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36", // who am i CURLOPT_AUTOREFERER => true, // set referer on redirect CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect CURLOPT_TIMEOUT => 120, // timeout on response CURLOPT_MAXREDIRS => 10, // stop after 10 redirects CURLOPT_POST => 1, // i am sending post data CURLOPT_SSL_VERIFYHOST => 0, // don't verify ssl CURLOPT_SSL_VERIFYPEER => false, // CURLOPT_VERBOSE => 1, // CURLOPT_HTTPAUTH => CURLAUTH_ANY, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_RETURNTRANSFER => 1, CURLOPT_POST => 1, CURLOPT_COOKIESESSION => TRUE, CURLOPT_COOKIEJAR => $cookie , CURLOPT_HTTPHEADER => $headers, CURLOPT_URL => $url, CURLOPT_POSTFIELDS => $curl_data , // this are my post var ); curl_setopt_array($ch,$options); // executimng the curl and storing it in the variable $store = curl_exec ($ch); // provides with web page echo $store; //print $store; // closing of curl initiation curl_close ($ch); ?> and output i get will be like user login page
-
I have this PHP script to fetch whois information of domain. It works, but when I try to connect whois server via proxy, then it doesnt work. The proxy ip is taken from proxylist.hidemyass.com. What I do wrong? Thank you for help. $server = "whois.nic.cz"; $domain = "klikzone.cz"; function QueryWhoisServer($server, $domain){ $proxy = "85.111.25.189:8080"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $server); curl_setopt($ch, CURLOPT_PORT, 43); curl_setopt($ch, CURLOPT_PROXY, $proxy); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $domain . "\r\n"); $data = curl_exec($ch); curl_close($ch); return $data; }
-
Hi everybody ! I have this current problem .. I need to login into a website via cUrl .. website : www.v-tac [dot] ro/ Now based on the headers and based on the input fields I wrote a php function, but I hit a wall with the token . HEADERS : username=username&password=password&Submit=Conectare&option=com_users&task=user.login&return=aW5kZXgucGhwP0l0ZW1pZD0yMTY%3D&0dbf64fe20e2395a7d72ed5b64b3cf7c=1 FORM FIELDS - copy paste - this is the login form <fieldset class="userdata"> <p id="form-login-username"> <label for="modlgn-username">Nume Utilizator</label> <input id="modlgn-username" type="text" name="username" class="inputbox" size="18"> </p> <p id="form-login-password"> <label for="modlgn-passwd">Parola</label> <input id="modlgn-passwd" type="password" name="password" class="inputbox" size="18"> </p> <p id="form-login-remember"> <label for="modlgn-remember">Retine utilizator</label> <input id="modlgn-remember" type="checkbox" name="remember" class="inputbox" value="yes"> </p> <input type="submit" name="Submit" class="button" value="Conectare"> <input type="hidden" name="option" value="com_users"> <input type="hidden" name="task" value="user.login"> <input type="hidden" name="return" value="aW5kZXgucGhwP0l0ZW1pZD0yMTY="> <input type="hidden" name="11b09608b3184e6258012d44846c81ed" value="1"> </fieldset> And this is the function I wrote to do the cUrl login : function login_to_website($targetURL){ global $browser_user_agent; if(empty($targetURL)) { return; } if(empty($login_url)) { $login_url = $targetURL; } $url = $login_url; $login_user = "loginusername"; $login_password = "loginpassword"; $thetoken = "this-is-my-problem-the-token-from-the-hidden-input"; $post_data = array(); $post_data['username'] = "$login_user"; $post_data['password'] = "$login_password"; $post_data['Submit'] = "Conectare"; $post_data['option'] = "com_users"; $post_data['task'] = "user.login"; $post_data['return'] = "aW5kZXgucGhwP0l0ZW1pZD0yMTY%3D"; $post_data[$thetoken] = "1"; $postthis = http_build_query($post_data); $login = curl_init(); curl_setopt($login, CURLOPT_COOKIEJAR, dirname(__FILE__) . "/cookie.tmpz"); curl_setopt($login, CURLOPT_COOKIEFILE, dirname(__FILE__) . "/cookie.tmpz"); curl_setopt($login, CURLOPT_VERBOSE, true); curl_setopt($login, CURLOPT_URL, $url); curl_setopt($login, CURLOPT_USERAGENT, random_user_agent()); curl_setopt($login, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($login, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($login, CURLOPT_POST, TRUE); $timeout = 5; curl_setopt( $login, CURLOPT_CONNECTTIMEOUT, $timeout ); curl_setopt( $login, CURLOPT_TIMEOUT, $timeout ); curl_setopt( $login, CURLOPT_MAXREDIRS, 10 ); curl_setopt($login, CURLOPT_POSTFIELDS, $postthis); // POST vars curl_setopt($login, CURLOPT_HEADER, 0); // debug headers sent - 1 $data = curl_exec ($login); curl_setopt($login, CURLOPT_URL, $targetURL); $datax = curl_exec ($login); return $datax; // close cURL resource, and free up system resources curl_close($login); } The problem is this the last array input. the token is generated each time the page is loaded, located on the page as an input hidden field . So the question is how do I get a fresh token that will work ? Also I have tried to get the token with a xpath extract like this : $htmlx = file_get_contents('http://www.v-tac.ro'); $htmlx = mb_convert_encoding($htmlx, 'UTF-8', mb_detect_encoding($htmlx)); //make sure this is utf8 if(!strlen($htmlx)) {echo "No HTML here . stoping execution ."; return;} $doc = new DomDocument; @$doc->loadHTML($htmlx); $xpath = new DOMXPath($doc); echo $xpath->query('//fieldset[@class="userdata"]/input[5]')->item(0)->getAttribute("name"); $thetoken = $xpath->query('//fieldset[@class="userdata"]/input[5]')->item(0)->getAttribute("name"); Help !?
-
Been working awhile on getting this completed with no luck I have this script that is suppose to purchase items through cookies <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_NOBODY, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_URL, ""); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0"); $data = array( 'creator' => '1', 'storeId' => '123', 'items' => '{id:123,species:stud,at:keepsake}', 'pType' => '0' ); $cookies = array( //Purchase cookie Goes here 'anx' => '', 'anxs' => '', 'JSESSIONID' => '', 'dcDirtyCookie' => '', 'user_num' => '', 'user_nme' => '', 'user_info' => '', 'qinfo' => '' ); curl_setopt($ch, CURLOPT_COOKIE, $cookies); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $output = curl_exec($ch); curl_close($ch); die($output); $xml = simplexml_load_string($output); print_r($xml,1); echo("done\n"); echo($output); ?> But.. Instead of it purchasing items with the script provided above and me having my cookies in there it just echo's them back out and onto the page, I would like for it to send the request to the requested url and purchase the item within the $data function.
-
Alright so as my title says I am working on trying to use curl to store the cookies of an item at the moment and fill out everything as listed. <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.example.com/purchased"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0"); //objekt array $TStringError = array( 'storeId' => 'ID', 'items' => 'ID', 'pType' => 'PType' ); $cookies = array( //detta ar dina inkops cookies 'anx' => 'UniqueCookie' ); curl_setopt ($ch, CURLOPT_COOKIE, //begagnade cookies ga hit "Användar Cookies Go Here" curl_setopt($ch, CURLOPT_POSTFIELDS, $TStringError); $output = curl_exec($ch); curl_close($ch); $xml = simplexml_load_string($output); print_r($xml,1); echo("done\n"); echo($output); ?> I started messing with my code because of an XML error it was not sending properly and I still am not sure why I just randomly saved it again and I was getting a T String Error but if I was to remove any thing from the line that it's on it would just error out another error.. curl_setopt($ch, CURLOPT_POSTFIELDS, $TStringError); This is what's giving me the error.. and if anyone could help me to know why it's not process the cookies properly.. that would be amazing. Sorry for bad english.
-
I'm using cURL to crawl and scrape data from a website. This website contains tables with rows of data. When I send a cURL POST for the underlying data at a specific row(A), it will return the expected data. But when I move to the second row(B), the data returns blank or specifically, a tons of spaces (or nbsp's.) When I access the cURL's POST location by browser, I can see (B)'s data. The only difference in the 2 POST's are location ID's for the data. I don't think it's a problem with JavaScript as I can successfully return data from row (A) as I mentioned. Website I'm trying to crawl: https://mycpa.cpa.state.tx.us/up/Search.jsp Working POST URL(A): https://mycpa.cpa.state.tx.us/up/searchresults.do?d-49216-p=&d-49216-s=&how=&last=bales&other=&d-49216-o=&zip=&_chk=74170700611986R2ZZZZ26&which=View+Details Non-working POST URL(B): https://mycpa.cpa.state.tx.us/up/searchresults.do?d-49216-p=&d-49216-s=&how=&last=bales&other=&d-49216-o=&zip=&_chk=74600015611995R1AC081084&which=View+Details Interestingly, you can combine the data location ID's to show more than 1 set of data per page. When trying this method, the first set of data(A) is displayed and the second(B) is shown as spaces (or nbsp.) Combined POST URL: https://mycpa.cpa.state.tx.us/up/searchresults.do?d-49216-p=&d-49216-s=&how=&last=bales&other=&d-49216-o=&zip=&_chk=74170700611986R2ZZZZ26&_chk=74600015611995R1AC081084&which=View+Details
-
Hi to everyone, I'm new to the forum and I'm posting here because I ended up in a logical problem for my next script development. I need to get some data of external websites (with vbulletin board), perfectly legal. Using file_get_contents i can print the page content on my server and then use jquery's powerful selectors to get my data. The problem is that these data are shown only to logged in users so i would need this script (maybe using cURL?) to either login to the external website and then persists the connection or maybe if the user who is executing my script is already logged in that website then use his login? (most likely impossible I think..) This is my code so far (found on some sites and merged into this) $data = array('vb_login_username' => 'Scanu', 'vb_login_password' => 'grgfgrgrfbtgbt'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.vbulletin.org/forum/login.php?do=login"); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_COOKIESESSION, true); curl_setopt($ch, CURLOPT_FAILONERROR, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $result = curl_exec($ch); curl_close($ch); $pattern = "#Set-Cookie: (.*?; path=.*?;.*?)\n#"; preg_match_all($pattern, $result, $matches); array_shift($matches); $cookie = implode("\n", $matches[0]); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.vbulletin.org/forum/"); curl_setopt($ch, CURLOPT_COOKIE, $cookie); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_COOKIESESSION, true); curl_setopt($ch, CURLOPT_FAILONERROR, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_POST, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); $result = curl_exec($ch); curl_close($ch); echo $result; ?> It just shows the same page for unregistered users. Any help or advice is appreciated, i'm very new to this type of script..
-
- curl
- file_get_contents
-
(and 3 more)
Tagged with:
-
Hi Guys and Girls, I'm having a bit of a hard time getting some pagination working. I have a script using CURL getting JSON results via a HTTP API. This is also used in a Wordpress Installation. The API call has a maximum of 50 records returned but allows pagination. What I can't seem to get right is actually getting this to work. Below is the code that I'm using: <?php //functions relating to wordpress go here: //---------------------------------------- $bg_colors = array('green', 'orange', 'blue', 'yellow', 'red', 'black'); //---------------------------------------- //End functions relating to wordpress // Start PetRescue PHP/API Code //---------------------------------------- // Open CuRL/JSON Stuff $ch = curl_init(); $category=$_GET['category']; $url="http://www.xxx.com.au/api/listings?token=xxxtokenxxx&group_id=xxx&species=".$category; curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Accept: application/json', 'X-some-API-Key: xxxtokenxxx', )); $json = json_decode(curl_exec($ch), true); //Pagination stuffs if($_GET['page']) { $page=substr($_GET['page'],1); echo 'page'.$page; } // Functions relating to the Echo Code foreach($json['listings'] as $listing) { $short_personality=substr($listing['personality'],0,500); $peturl="http://xxx.org.au/pet-info/?petid=".$listing['id']; $medium_photo=$listing['photos'][0]['large_340']; $gallery_first=$listing['photos'][0]['xlarge_900']; $gender_class=strtolower($listing['gender']); $breed_class=strtolower($listing['species']); $name=($listing['name']); $unique_gallery_name="lightbox['.$inc.']"; $inc++; foreach($listing['photos'] as $photosthumb) { $photo_thumb_large=$photosthumb["xlarge_900"]; $photo_thumb_hidden=$photosthumb["xlarge_340"]; } $rand_background = $bg_colors[array_rand($bg_colors)]; // General IF/AND/ELSE Statements to refine the Echo Output if($listing['photos'] == null) { $medium_photo="http://xxx.org.au/wp-content/themes/xxx/images/photo_coming_soon.png"; } if($listing['desexed'] == "Yes") { $desexed="yes"; } else { $desexed="no"; } if($listing['vaccinated'] == "Yes") { $vaccinated="yes"; } else { $vaccinated="no"; } if($listing['wormed'] == "Yes") { $wormed="yes"; } elseif($listing['wormed'] == "No") { $wormed="no"; } else { $wormed="no"; } if($listing['heart_worm_treated'] == "Yes") { $heart_worm_tested="yes"; } elseif($listing['heart_worm_treated'] == "No") { $heart_worm_tested="no"; } else { $heart_worm_tested="no"; } if($listing['species'] == "Dog") { $adoption_enquiry_link="http://xxx.org.au/pre-adoption-form-dogs/?dog_name=$name"; $hwt="list-$heart_worm_tested"; } elseif($listing['species'] == "Cat") { $adoption_enquiry_link="http://xxx.org.au/pre-adoption-form-cats/?cat_name=$name"; $hwt="list-hwt-hidden"; } // Echo the output echo'<div class="animal"> <div class="animal-image"> <a class="size-thumbnail thickbox" rel="'.$unique_gallery_name.'" href="'.$gallery_first.'"> <img src="'.$medium_photo.'" class="image-with-border" alt=""> <div class="border" style="width: 340px; height: 340px;"> <div class="open"></div> </div> </a> <div class="item-title-bg '.$rand_background.'"> <h2 class="entry-title"> '.$listing['name'].'</h2> <div class="animal-adopt-button"> <a href="'.$adoption_enquiry_link.'" style="background-color: #575757; border-color: #494949; background-position:5px 0;" class="button medium"> Enquire about '.$name.'</a> </div> </div> </div> <div class="animal-thumbnail hidden"> <a class="lightbox" rel="'.$unique_gallery_name.'" href="'.$photo_thumb_large.'"> <img class="animal-thumbnail" src="'.$photo_thumb_hidden.'" > </a> </div> <div class="animal-content"> <div class="animal-left"> <ul class="animal-list"> <li class="list-sex-'.$gender_class.'">'.$listing['gender'].'</li> <li class="list-breed-'.$breed_class.'">'.$listing['breeds_display'].'</li> <li class="list-age">'.$listing['age'].'</li> <li class="list-fee">'.$listing['adoption_fee'].'</li> </ul> </div> <div class="animal-right"> <ul class="animal-list"> <li class="list-'.$desexed.'">Desexed?</li> <li class="list-'.$vaccinated.'">Vaccinated?</li> <li class="list-'.$wormed.'">Wormed?</li> <li class="'.$hwt.'">Heart Worm Tested?</li> </ul> </div> <div class="animal-full"> <ul class="animal-list"> <li class="list-description">'.$listing['personality'].'</li> </ul> </div></div> <div class="clearer"></div> </div> <div class="delimiter"></div>'; // Close the CURL } echo' <div class="pagination footer-pagination"> <nav class="pagination"> <div class="pages">'; for($i=1;$i<=$json['total_pages'];$i++) { $this_page=substr($_GET['page'],1); $active=""; if($i==$this_page) { $active="active"; } echo ' <span class="page'. $active.'"> <span class="number"> <a rel="prev" href="http://xxx.org.au/pet/?category=dog&page='.$i.'"> '.$i.'</a> </span> </span> </div> </nav> </div>'; curl_close($ch); } ?> This is a sample of the JSON results: {"listings":[{"adoption_fee":"$200 ","adoption_process":"For cats, please fill out our <a href=\"http://xxx.org.au/pre-adoption-form-cats/\">Pre-Adoption Questionnaire - Cats</a>.\r\n\r\nFor dogs, please fill out our <a href=\"http://xxx.org.au/pre-adoption-form-dogs/\">Pre-Adoption Questionnaire - Dogs</a>.\r\n\r\nFor more information on our Adoption Process, please visit this <a href=\"http://xxx.au/our-adoption-process/\">link</a>.\r\n\r\nPlease make sure that you are familiar with our <a href=\"http://xxx.org.au/adoption-agreement/\">Adoption Agreement</a> as it has recently changed.\r\n\r\nFor more information on any of our animals, please <a href=\"http://xxx.org.au/contact-us/\">Contact Us</a>.","age":"2 years 5 months","breeds":["Domestic Long Hair"],"breeds_display":"Domestic Long Hair","coat":"Long","contact_name":null,"contact_number":null,"contact_preferred_method":"Email","created_at":"30/1/2014 21:36","date_of_birth":"20/2/2012","desexed":true,"foster_needed":false,"gender":"Female","group":"xxx","heart_worm_treated":null,"id":273191,"interstate":false,"last_updated":"5/8/2014 12:20","medical_notes":"","microchip_number":"","mix":false,"multiple_animals":false,"name":"Helena HC13-394","personality":"Stunning Helena!\r\n\r\nThis beautiful girl is looking for a home that is fairly relaxed. She is not happy about sharing her current foster home with some bossy cats, she likes to be the princess of her realm.\r\n\r\nShe is very affectionate, and when it is quiet she will come and have a big smooch around our legs, and purr her pretty little purr. \r\n\r\nShe is somewhat timid to start with, but enjoys the company of people and once she trusts, she's a very special companion.\r\n\r\n","photos":[{"small_80":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_cb61a_70x70.jpg","medium_130":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_cb61a_130x130.jpg","large_340":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_cb61a_340x340.jpg","xlarge_900":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_cb61a_900x900.jpg"},{"small_80":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_7a7a7_70x70.jpg","medium_130":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_7a7a7_130x130.jpg","large_340":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_7a7a7_340x340.jpg","xlarge_900":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_7a7a7_900x900.jpg"},{"small_80":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_8b90b_70x70.jpg","medium_130":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_8b90b_130x130.jpg","large_340":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_8b90b_340x340.jpg","xlarge_900":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_8b90b_900x900.jpg"},{"small_80":"http://xxx.com.au/uploads/pet_photos/2014/4/26/273191_691df_70x70_96020.jpg","medium_130":"http://xxx.com.au/uploads/pet_photos/2014/4/26/273191_691df_130x130_96020.jpg","large_340":"http://xxx.com.au/uploads/pet_photos/2014/4/26/273191_691df_340x340_96020.jpg","xlarge_900":"http://xxx.com.au/uploads/pet_photos/2014/4/26/273191_691df_900x900_96020.jpg"},{"small_80":"http://xxx.com.au/uploads/pet_photos/2014/4/26/273191_6d9da_70x70_d2d41.jpg","medium_130":"http://xxx.com.au/uploads/pet_photos/2014/4/26/273191_6d9da_130x130_d2d41.jpg","large_340":"http://xxx.com.au/uploads/pet_photos/2014/4/26/273191_6d9da_340x340_d2d41.jpg","xlarge_900":"http://xxx.com.au/uploads/pet_photos/2014/4/26/273191_6d9da_900x900_d2d41.jpg"},{"small_80":"http://xxx.com.au/uploads/pet_photos/2014/7/12/273191_f209f_70x70_982c6.jpg","medium_130":"http://xxx.com.au/uploads/pet_photos/2014/7/12/273191_f209f_130x130_982c6.jpg","large_340":"http://xxx.com.au/uploads/pet_photos/2014/7/12/273191_f209f_340x340_982c6.jpg","xlarge_900":"http://xxx.com.au/uploads/pet_photos/2014/7/12/273191_f209f_900x900_982c6.jpg"}],"senior":false,"size":null,"species":"Cat","state":"WA","vaccinated":"Yes","wormed":"Yes"}, And the pagination details are at the bottom of the JSON response: "page":"1","per_page":"50","total_pages":"6" The issue I get with all of this, is when calling the PHP file again, it's just returning the first page of results and not the second page. Any help would stop me from eating my own eyeballs, as I've been staring at this for hours! Cheers, Dave
- 3 replies
-
- php
- pagination
-
(and 3 more)
Tagged with:
-
I want to grab the title of a cl page using curl, can anyone help me with this? I have the urls stored in a table I just need can't get it to read the title of the post in CL, let me know if you can help.