Jump to content
Sign in to follow this  

Get curl details for current page.

Recommended Posts


A bit stumped really. I'm trying get get a live test for given urls, mainly the url you're currently on. I've the following which works, but never on the page you're viewing, it just hangs so I'm missing something for sure;

function pageReport($var) {
	$ch = curl_init($var);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_VERBOSE, 1);
	curl_setopt($ch, CURLOPT_HEADER, 1);
	$arry = curl_getinfo($ch);
	return $arry;
$wdf = pageReport('https://www.webdesignerforum.co.uk/forum/95-server-side/');
print_r($wdf); // Works
$other_page = pageReport('https://www.mydomain.co.uk/other-page.php');
print_r($other_page); // Works
// However add the following and it goes squiffy...
$this_page = pageReport('https://www.mydomain.co.uk/test.php'); // this is the page we're testing on

I'm sure it freaks due to some weird double connection on the current page? Any ideas around this?


Update: After much digging a few articles the best answer to what's happening; "Be aware that if you're issuing the CURL request to your own site, you're using the default session handler, and the page you're requesting via CURL uses the same session as the page that's generating the request, you'll run into a deadlock situation." stackoverflow.

For me i'm still struggling, I've a cron approach I'm working on to generate for each page at set intervals and saving the array for inclusion; essentially running this page on it's own is fine for any urls on the site as it never tests self. It's a small site so not many to do, would rather a cleaner method if anyone has any ideas?

Edited by BrowserBugs

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Similar Content

    • By rookie
      I’m very curious about this topic cause the definition of web designer is different from country to country, for example some countries define a web designer as a person who knows design and programing (Javascript and php etc).
      I wanna know where you are from and which language you need to be web designer like the following.
      Country   :  Japan
      Language:   HTML,CSS,*JavaScript, *wordpress 
      *As to JavaScript, you don’t have to know everything about it but at least how it works. 
        Plus you basically just need to know how to customize jQuery.
       I really wanna know to what extent I should learn JS or php if I need to learn them as web designer in some countries.
      Thanks in advance for your help ! 
    • By Willows
      Hi guys, im working on a small project and need some help with bits and pieces (paid work ofc) if you would like to speak on skype please add me: willows420
      Appreciate this is probably the wrong place to post this but didnt see a paid work thread, so what the heck, move if needed! 
    • By Lyndsey
      Hi guys,
      I thought it would be cool to start a topic for people to share sites they find useful for their design/development processes. Here is a list of sites I find useful and/or use regularly:
      General Stuff:
      http://jsfiddle.net/ - Useful for JavaScript troubleshooting. Test your code and just play around with HTML/CSS and JavaScript. If you're looking for help with a piece of code, save your Fiddle and send it to someone else who can take a look at it You can also save revisions of your Fiddle to track your progress. http://pastebin.com/ - Useful for sharing code online. Useful for when you run in to a bit of trouble with some server-side code. Instead of pasting masses of lines inside a topic, paste your code in to pastebin and get someone to have a look at it for you http://jsonlint.com/ - JSON Validator http://paletton.com/ - Color Scheme Designer. See what colours complement each other etc. Useful stuff. http://www.lipsum.com/ - Lorem Ipsum - Useful for inserting dummy text in to your web pages. http://net.tutsplus.com/category/tutorials/php/ - PHP tutorials, quizzes etc. They also do the same for JavaScript, HTML, CSS, WordPress, ASP.NET to name a few. Really good site.  
      You Don't Know JavaScript - https://github.com/getify/You-Dont-Know-JS JavaScript scene https://medium.com/javascript-scene Webpack Asset bundler https://webpack.js.org/ Jest, Automated tests for JavaScript https://facebook.github.io/jest/  
      http://css3generator.com/ - Generate CSS3. Box Shadow, Border Radius etc. http://border-radius.com/ - Generate border radius quickly! http://www.javascripter.net/faq/hextorgb.htm - HEX to RGB conversion. http://meyerweb.com/eric/tools/css/reset/ - CSS Reset Stylesheet. Resolve browser inconsistencies such as varying margins/padding. http://www.cssplay.co.uk - Lots of experiments with CSS, menus and layouts. CSS Wizardry: https://csswizardry.com/ Sass Guidelines https://sass-guidelin.es/  
      Responsive Design:
      http://www.getskeleton.com/ - Responsive Grid. Nebula - a framework built by WDF member, rbrtsmith: https://nebulaui.github.io/nebula/  
      Server-Side Coding:
      http://net.tutsplus.com/tutorials/php/php-database-access-are-you-doing-it-correctly/ - How to connect to a database using PDO http://www.php.net/manual/en/index.php - PHP manual for everything PHP!  
      Form Validation (Client-Side):
      https://jqueryvalidation.org/ - (My preferred method) Simple to use. Include the necessary jQuery and Validation.js files. Simple usage example, call the function using $('#myForm').validate(); and add a class="required" to fields you want to validate Also allows you to create custom messages and make the validation more advanced! I hope these are useful! If anyone has any others to share, please do
    • By GrahamUK33
      Is it good to use page extensions in the URL such as .HTML .PHP
      Are there any Pros and Cons using/not using page extensions?
    • By Drummer
      Hi guys
      I've created a website which i would like to "wrap" in a members-only environment. I don't want to re-invest the wheel, but looking for a register page, login page, password reset, and all the links/instructions to hook it up to the remote server the website is currently on.
      Does anyone have any pointers for this type of thing? I've tried googling, but struggling tbh!
  • Recently Browsing

    No registered users viewing this page.

  • Member Statistics

    • Total Members
    • Most Online

    Newest Member
  • Forum Statistics

    • Total Topics
    • Total Posts